Update pages/3_Earnings_Semantic_Search_π_.py
Browse files
pages/3_Earnings_Semantic_Search_π_.py
CHANGED
@@ -52,10 +52,10 @@ if search_input is not None:
|
|
52 |
|
53 |
print(sen_df)
|
54 |
|
55 |
-
def gen_annotated_text(para):
|
56 |
tag_list = []
|
57 |
for i in sent_tokenize(para):
|
58 |
-
label =
|
59 |
if label == 'Negative':
|
60 |
tag_list.append((i,label,'#faa'))
|
61 |
elif label == 'Positive':
|
@@ -64,7 +64,7 @@ if search_input is not None:
|
|
64 |
tag_list.append((i,label,'#fea'))
|
65 |
return tag_list
|
66 |
|
67 |
-
text_to_annotate = [gen_annotated_text(para) for para in df.Text.tolist()]
|
68 |
|
69 |
first,second = text_to_annotate[0],text_to_annotate[-1]
|
70 |
|
|
|
52 |
|
53 |
print(sen_df)
|
54 |
|
55 |
+
def gen_annotated_text(para,df=sen_df):
|
56 |
tag_list = []
|
57 |
for i in sent_tokenize(para):
|
58 |
+
label = df.loc[df['text']==i, 'label'].values[0]
|
59 |
if label == 'Negative':
|
60 |
tag_list.append((i,label,'#faa'))
|
61 |
elif label == 'Positive':
|
|
|
64 |
tag_list.append((i,label,'#fea'))
|
65 |
return tag_list
|
66 |
|
67 |
+
text_to_annotate = [gen_annotated_text(para,sen_df) for para in df.Text.tolist()]
|
68 |
|
69 |
first,second = text_to_annotate[0],text_to_annotate[-1]
|
70 |
|