Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -43,8 +43,22 @@ def proc_sen(sen_list,cnt):
|
|
43 |
if n[1] == "NN":
|
44 |
noun_box1.append(n[0])
|
45 |
json_object={'sentence':sen_list[cnt],'noun_phrase':noun_p,'nouns':noun_box1}
|
|
|
|
|
|
|
|
|
46 |
return json_object
|
47 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
48 |
def get_nouns(text=text,steps=1):
|
49 |
control_len=control_json['leng']-steps
|
50 |
control_char=list(control_json['control'][:control_len])
|
@@ -121,10 +135,8 @@ def get_nouns(text=text,steps=1):
|
|
121 |
if big_cnt==key_cnt:
|
122 |
print("DONE")
|
123 |
go=False
|
124 |
-
|
125 |
-
|
126 |
-
|
127 |
-
return json_out,noun_list
|
128 |
|
129 |
|
130 |
|
|
|
43 |
if n[1] == "NN":
|
44 |
noun_box1.append(n[0])
|
45 |
json_object={'sentence':sen_list[cnt],'noun_phrase':noun_p,'nouns':noun_box1}
|
46 |
+
|
47 |
+
|
48 |
+
|
49 |
+
|
50 |
return json_object
|
51 |
|
52 |
+
def proc_nouns(sen_list):
|
53 |
+
noun_list={}
|
54 |
+
for i,nn in enumerate(list(sen_list.keys())):
|
55 |
+
for nnn in sen_list[nn]['nouns']:
|
56 |
+
if nnn in list(noun_list.keys()):
|
57 |
+
noun_list[str(nnn)].append(nn)
|
58 |
+
else:
|
59 |
+
noun_list[str(nnn)]=[nn]
|
60 |
+
return noun_list
|
61 |
+
|
62 |
def get_nouns(text=text,steps=1):
|
63 |
control_len=control_json['leng']-steps
|
64 |
control_char=list(control_json['control'][:control_len])
|
|
|
135 |
if big_cnt==key_cnt:
|
136 |
print("DONE")
|
137 |
go=False
|
138 |
+
noun_list=proc_nouns(json_out)
|
139 |
+
return json_out, noun_list
|
|
|
|
|
140 |
|
141 |
|
142 |
|