Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -8,20 +8,19 @@ st.title('Entity Extraction')
|
|
| 8 |
|
| 9 |
def prediction(raw_text):
|
| 10 |
text1= NER(raw_text)
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
|
| 14 |
for word in text1.ents:
|
| 15 |
-
|
| 16 |
print()
|
| 17 |
-
|
| 18 |
-
|
| 19 |
-
|
| 20 |
|
| 21 |
raw_text = """Ai-Khanoum (/aɪ ˈhɑːnjuːm/, meaning Lady Moon; Uzbek: Oyxonim) is the archaeological site of a Hellenistic city in Takhar Province, Afghanistan.
|
| 22 |
The city, whose original name is unknown,[a] was probably founded by an early ruler of the Seleucid Empire and served as a military and economic centre for the rulers of the Greco-Bactrian Kingdom until its destruction c. 145 BC.
|
| 23 |
Rediscovered in 1961, the ruins of the city were excavated by a French team of archaeologists until the outbreak of conflict in Afghanistan in the late 1970s. """
|
| 24 |
-
|
| 25 |
-
|
| 26 |
-
st.markdown(html_string,unsafe_allow_html=True)
|
| 27 |
|
|
|
|
| 8 |
|
| 9 |
def prediction(raw_text):
|
| 10 |
text1= NER(raw_text)
|
| 11 |
+
st.write("List wise NERs:")
|
| 12 |
+
st.write("------------------")
|
| 13 |
+
st.write(f"{'Text' : <10}{'NER' : >10}")
|
| 14 |
for word in text1.ents:
|
| 15 |
+
st.write(word.text,"\t\t",word.label_)
|
| 16 |
print()
|
| 17 |
+
st.write("------------------")
|
| 18 |
+
st.write("NERs in the sentence:")
|
| 19 |
+
st.markdown(displacy.render(text1,style="ent"))
|
| 20 |
|
| 21 |
raw_text = """Ai-Khanoum (/aɪ ˈhɑːnjuːm/, meaning Lady Moon; Uzbek: Oyxonim) is the archaeological site of a Hellenistic city in Takhar Province, Afghanistan.
|
| 22 |
The city, whose original name is unknown,[a] was probably founded by an early ruler of the Seleucid Empire and served as a military and economic centre for the rulers of the Greco-Bactrian Kingdom until its destruction c. 145 BC.
|
| 23 |
Rediscovered in 1961, the ruins of the city were excavated by a French team of archaeologists until the outbreak of conflict in Afghanistan in the late 1970s. """
|
| 24 |
+
prediction(raw_text)
|
| 25 |
+
|
|
|
|
| 26 |
|