Files
tomosco/projects_playground.py
2022-04-19 13:55:24 +02:00

92 lines
5.6 KiB
Python

# %%
# %%
nlp_tools = NLPTools()
# %%
talako_project = "Taxi vehicles are particularly suitable for electrification due to their potentially long waiting periods at taxi stops. However, existing charging solutions for electric vehicles require taxi drivers to manually initiate and stop the charging process by connecting and disconnecting a charging cable to a charging station. This makes the use of electric vehicles in taxi operations cumbersome and impractical. The goal of the project is the development of a modular inductive charging solution for electric vehicles that is suitable for taxi operations in public spaces. To validate the solution, the project will deploy a prototype system in a private space and a pilot system in a public space. Within the project, the Networked Embedded Systems group is responsible for the development of a camera-based positioning system that enables taxi drivers to optimally position their cars on the charging system. The goal thereby is to maximize the efficiency factor of the charging solution without complex mechanical solutions that align the inductive charging plates otherwise."
# %%
test= []
test.append(talako_project)
test_corpus = nlp_tools.nlp_pipeline_en(test)
# %%
df = pd.read_csv("zlv_pubs.csv")
df_collabs = pd.read_csv("zlv_pubs_collabs.csv")
# %%
SAMPLE_SIZE = 20
THRESHOLD_SIZE = 5
KEEP_DUPLICATES = False
MIN_TOPICS= 5
# %%
bert_instance = BertUtilClass([60,60,60], df, MIN_TOPICS, KEEP_DUPLICATES, SAMPLE_SIZE, THRESHOLD_SIZE, df_collabs)
bert_models = bert_instance.calculate_return_model()
# %%
model = bert_models["en"]["model"]
topic_df = bert_models["en"]["topic_df"]
# %%
yake_talako =["potentially long waiting","long waiting periods","electric vehicles","electrification due","potentially long","long waiting","waiting periods","charging","Taxi","electric vehicles require","vehicles require taxi","vehicles","charging solution","Networked Embedded Systems","suitable for electrification","taxi drivers","taxi operations","existing charging solutions","taxi stops","system"]
# %%
#topic_df.loc[topic_df["Dominant_topic"] == 5].sort_values(by="Topic_contribution", ascending=False)
# %%
topics, similarities = model.find_topics(test_corpus[0], top_n=10)
for idx,tupel in enumerate(zip(topics, similarities)):
topic_num, similarity = tupel
topic_keywords = ", ".join([word[0] for word in model.get_topic(topic_num)])
print(topic_num)
print(similarity)
print(topic_keywords)
print("institute:", {topic_df.loc[topic_df["Dominant_topic"] == topic_num]["institute_code"].values[0]})
print("institute:", {topic_df.loc[topic_df["Dominant_topic"] == topic_num]["institute"].values[0]})
print("paper:" , topic_df.loc[topic_df["Dominant_topic"] == topic_num]["_source.title"].values[0])
print("________________________")
# %%
lda_instance = LDAUtilClass([60,60,60], df, KEEP_DUPLICATES, SAMPLE_SIZE, THRESHOLD_SIZE, df_collabs)
lda_models = lda_instance.calculate_return_model()
# %%
test= []
test.append(moin_project)
test.append(talako_project)
test_corpus = nlp_tools.nlp_pipeline_en(test)
# %%
model = lda_models["en"]["model"]
dic = lda_models["en"]["dic"]
topic_df = lda_models["en"]["topic_df"]
# %%
yake_talako =["potentially long waiting","long waiting periods","electric vehicles","electrification due","potentially long","long waiting","waiting periods","charging","Taxi","electric vehicles require","vehicles require taxi","vehicles","charging solution","Networked Embedded Systems","suitable for electrification","taxi drivers","taxi operations","existing charging solutions","taxi stops","system"]
# %%
topics = model[dic.doc2bow(yake_talako)]
topics.sort(key=lambda x: x[1], reverse= True)
for i, topic in enumerate(topics):
wp = lda_models["en"]["model"].show_topic(topic[0])
topic_keywords = ", ".join([word for word, prop in wp])
print(topic[0], topic[1])
print(topic_keywords)
print("institute:", {topic_df.loc[topic_df["Dominant_topic"] == topic[0]]["institute_code"].values[0]})
print("institute:", {topic_df.loc[topic_df["Dominant_topic"] == topic[0]]["institute"].values[0]})
print("paper:" , topic_df.loc[topic_df["Dominant_topic"] == topic[0]]["_source.title"].values[0])
print("________________________")
# %%
moin_project = "Although reachability is one of the most important location factors for citizens and companies, there is currently no source in Germany that evaluates it comprehensively and nationwide. In general, reachability consists of a broad spectrum of quality features. In addition to cost, they also include time, frequency and capacity of the various means of transport. Existing maps, timetables and navigation systems usually only show a selection of these features. The goal of MoIn is to develop a concept for a nationwide mobility index and to evaluate the technical and economic feasibility of its nationwide provisioning. As part of the project, the following must be clarified: how a holistic mapping of the mobility system can be realized across carrier systems and modality chains, which criteria for reachability can be systematically recorded and mapped, in which use cases the index created in this way can be integrated in a beneficial way and finally how an operation and the continuous updating of the index can be realized in a sustainable manner. To answer these questions, the mobility index is prototypically calculated for a selected area as part of MoIn and provided along with interactive visualizations via a dashboard. Within the project, researchers of NES are responsible for studying efficient algorithms to compute the mobility index in a scalable maner."
test= []
test.append(moin_project)
test_corpus = nlp_tools.nlp_pipeline_en(test)