demo rule-based matcher results a Value Error in search patterns

i used the public demo tool to build patterns for a rule based matcher. This works well mostly.

i used it net.teach with this string:

prodigy ner.teach DatasetName en_core_web_lg ~/prg-datasets/turc/txt2.txt --label Catalog --patterns ~/prg-datasets/turc/dataset_patterns.jsonl

But the current generated string results an error: Value Error: Invalid JSON

{"label":"Catalog,"pattern" : [{"ORTH": "Catalog"},{"IS_PUNCT": True},{"ORTH": "LW"},{"IS_PUNCT": True},{"ORTH": "No"},{"SHAPE": "ddd/dddd"}]}

Does it only work on local displacy because of spacy Versioning?

I think the problem here is that in spaCy, you were using a pattern written in Python and in Prodigy, you’re using a JSON file.

In Python, boolean values are capitalised, e.g. True and False. In JSON, they’re lowercase, e.g. true and false. So the JSON validator complains, because things like "IS_PUNCT": True is not valid JSON. If you fix that in your pattern, it should work as expected.

thank’s and sorry, stupid of me. i already passed this by changing the syntax, but I’ve missed that.

That gives a coffee to me.

1 Like