ValueError: [E002] Can't find factory for ....

I am currently having a hard time adding the second custom entity ruler - the one that tags units of measurement - and receiving this error message. I have reviewed documentation, but I still could use some help. If you have any thoughts on how to resolve this issue, I would greatly appreciate your feedback.

Here is the relevant code:

nlp = spacy.load("en_core_web_lg")

rulerIngs = nlp.add_pipe("rulerIngs", before="ner")
rulerUms = nlp.add_pipe("rulerUms", before="ner")

rulerIngs.from_disk("patterns/ing_patterns2021-10-11.jsonl")
rulerUms.from_disk("patterns/ums_patterns2021-10-11.jsonl")

nlp.to_disk(ings_rules)
nlp.to_dick(ums_rules)

print("Names of pipelines:")
print("")
print(nlp.pipe_names)

print("")
print("")
print("This is the decoded recipe:")
print("")
print("")

for line in index:
doc = nlp(line)
for ent in doc.ents:
print(ent.text, ent.label_)

	if ent.label_ == "UMS":
		print(ent.text, ent.label_)
		if ent.label == "ING":
			print(ent.text, ent.label_)

displacy.render(doc, style='dep')

Hi! The first argument of add_pipe is the name of the factory, i.e. the string name of the component to create. This tells spaCy which function to use for your component. Assuming that you want to create an entity ruler, that name would be entity_ruler: https://spacy.io/api/entityruler/

In addition to that, you can define a custom unique name for your component, for instance rulerIngs:

rulerIngs = nlp.add_pipe("entity_ruler", name="rulerIngs", before="ner")
rulerUms = nlp.add_pipe("entity_ruler", name="rulerUms", before="ner")

So what the error is basically trying to tell you is: "I don't know which function rulerIngs is and how to create it!".

By the way, we try to keep this forum very focused on Prodigy and for general usage questions around spaCy, the discussion board is usually a better fit: Discussions · explosion/spaCy · GitHub There you have access to the whole spaCy community and spaCy development team, and more people can benefit from the answer :raised_hands:

Yeah! That was I needed to do. Name them and it worked fine. And I apologize for asking a spaCy question in a Prodigy space. Those lines have become a little blurred as I climb the learning curve. But I will be more mindful in the future.

Thanks again.

Robert