File size: 1,081 Bytes
324bed5
a988da7
 
 
 
df13e11
a988da7
 
9adb6ba
 
 
 
 
 
 
 
 
 
 
4e870ab
9adb6ba
 
 
 
 
a988da7
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
import streamlit as st 
import spacy
from spacy import displacy
import en_core_web_sm

NER = spacy.load("en_core_web_sm")
st.title('Entity Extraction')

def prediction(raw_text):
  text1= NER(raw_text)
  print("List wise NERs:")
  print("------------------")
  print(f"{'Text' : <10}{'NER' : >10}")
  for word in text1.ents:
    print(word.text,"\t\t",word.label_)
  print()
  print("------------------")
  print("NERs in the sentence:")
  return displacy.render(text1,style="ent")

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. 
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. 
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. """

st.markdown(prediction(raw_text))