mertguvencli's picture
Update app.py
eabfbb5
raw
history blame contribute delete
831 Bytes
import spacy
import streamlit as st
from spacy_streamlit import visualize_ner
try:
spacy.load("en_core_web_sm")
except:
spacy.cli.download("en_core_web_sm")
st.write("""
# Extract the tech keywords on Data Science jobs using NER.
""")
nlp = spacy.load("en_core_web_sm")
ruler = nlp.add_pipe("entity_ruler", before="ner")
ruler.from_disk("patterns.jsonl")
description = "Built with love πŸ’™ Python, Spacy, Streamlit and Huggingface πŸ€—"
text = st.text_area(label='Job Description', value=description, placeholder='Please enter a job description')
doc = nlp(text)
visualize_ner(doc, labels=nlp.get_pipe("ner").labels)
st.subheader('Tech Keywords')
st.json(
[{'label': entity.label_, 'text': entity.text, 'start': entity.start, 'end': entity.end} \
for entity in doc.ents if entity.ent_id_ == 'SKILLS']
)