Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -9,10 +9,10 @@ cont_list=list(string_json['control'])
|
|
9 |
def get_nouns(text):
|
10 |
json_object={}
|
11 |
sen_list=[]
|
12 |
-
noun_list=
|
13 |
blob = TextBlob(text)
|
14 |
for sentence in blob.sentences:
|
15 |
-
print(sentence)
|
16 |
sen_list.append(str(sentence))
|
17 |
|
18 |
key_cnt=len(sen_list)
|
@@ -31,7 +31,14 @@ def get_nouns(text):
|
|
31 |
#for i,ea in enumerate(key_list):
|
32 |
#json_object[sen_list[cnt]]=f'{a}{cont_list[b]}{cont_list[c]}{cont_list[d]}'
|
33 |
blob_n = TextBlob(sen_list[cnt])
|
34 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
35 |
if json_object[f'{a}{cont_list[b]}{cont_list[c]}{cont_list[d]}']=='ZNNN':
|
36 |
#if json_object[sen_list[cnt]]=='ZNNN':
|
37 |
#print ("Y")
|
|
|
9 |
def get_nouns(text):
|
10 |
json_object={}
|
11 |
sen_list=[]
|
12 |
+
noun_list={}
|
13 |
blob = TextBlob(text)
|
14 |
for sentence in blob.sentences:
|
15 |
+
#print(sentence)
|
16 |
sen_list.append(str(sentence))
|
17 |
|
18 |
key_cnt=len(sen_list)
|
|
|
31 |
#for i,ea in enumerate(key_list):
|
32 |
#json_object[sen_list[cnt]]=f'{a}{cont_list[b]}{cont_list[c]}{cont_list[d]}'
|
33 |
blob_n = TextBlob(sen_list[cnt])
|
34 |
+
noun_p=blob_n.noun_phrases
|
35 |
+
json_object[f'{a}{cont_list[b]}{cont_list[c]}{cont_list[d]}']={'sentence':sen_list[cnt],'nouns':noun_p}
|
36 |
+
for noun in noun_p:
|
37 |
+
if noun_list[noun]:
|
38 |
+
noun_list[noun].append(f'{a}{cont_list[b]}{cont_list[c]}{cont_list[d]}')
|
39 |
+
else:
|
40 |
+
noun_list[noun]=[f'{a}{cont_list[b]}{cont_list[c]}{cont_list[d]}']
|
41 |
+
noun_list.append({'nouns':})
|
42 |
if json_object[f'{a}{cont_list[b]}{cont_list[c]}{cont_list[d]}']=='ZNNN':
|
43 |
#if json_object[sen_list[cnt]]=='ZNNN':
|
44 |
#print ("Y")
|