Spacy Streamlit Visualizing Custom Entity Ruler

Hey everyone,

I’m new to Spacy Streamlit, I’m trying to visualize tagged text from patterns added to my custom entity_ruler. This is the example from the Github:

models = [ā€œen_core_web_smā€, ā€œen_core_web_mdā€]
default_text = ā€œSundar Pichai is the CEO of Google.ā€
spacy_streamlit.visualize(models, default_text)

I have an Excel document I’m pulling in for creating custom labels that get added to the ruler. I’ve tried replacing the model names in the code above with ā€œnlpā€ and defining the nlp as spacy.load(ā€œen_core_web_mdā€). No dice. Has anyone figured this out?

When I did that, it threw an error saying cannot find ā€˜nlp’ model.

This is what I’m using to pull in the dataframes as labels:

nlp = spacy.load(ā€œen_core_web_lgā€)
ruler = nlp.add_pipe(ā€œentity_rulerā€, before=ā€œnerā€, config={ā€œphrase_matcher_attrā€: ā€œLOWERā€})
patterns =
for word in df_:
patterns.append({ā€œlabelā€: ā€œRelationshipā€, ā€œpatternā€: word})
for word1 in df1_:
patterns.append({ā€œlabelā€: ā€œEventā€, ā€œpatternā€: word1})
for word2 in df2_:
patterns.append({ā€œlabelā€: ā€œName Typeā€, ā€œpatternā€: word2})
for word3 in df3_:
patterns.append({ā€œlabelā€: ā€œA Typeā€, ā€œpatternā€: word3})
for word4 in df4_:
patterns.append({ā€œlabelā€: ā€œB Typeā€, ā€œpatternā€: word4})
ruler.add_patterns(patterns)
ruler.add_patterns(repatterns)