File size: 437 Bytes
a41c991
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
import spacy
import streamlit as st
nlp = spacy.load("en_core_web_sm")

def return_NER(value):
    doc = nlp(value)
    return [(X.text, X.label_) for X in doc.ents]

# Add title on the page
st.title("Spacy - Named Entity Recognition")

# Ask user for input text
input_sent = st.text_input("Input Sentence", "Your input sentence goes here")

# Display named entities
for res in return_NER(input_sent):
    st.write(res[0], "-->", res[1])