explosion / sense2vec

🦆 Contextually-keyed word vectors
https://explosion.ai/blog/sense2vec-reloaded
MIT License
1.62k stars 240 forks source link

Error running sense2vec.to-patterns recipe #121

Closed npattarone closed 3 years ago

npattarone commented 4 years ago

I have an error when trying to extract the patterns after performing a sense2vec.teach:

Traceback (most recent call last):
  File "/opt/anaconda3/lib/python3.7/runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "/opt/anaconda3/lib/python3.7/runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "/opt/anaconda3/lib/python3.7/site-packages/prodigy/__main__.py", line 60, in <module>
    controller = recipe(*args, use_plac=True)
  File "cython_src/prodigy/core.pyx", line 300, in prodigy.core.recipe.recipe_decorator.recipe_proxy
  File "/opt/anaconda3/lib/python3.7/site-packages/plac_core.py", line 367, in call
    cmd, result = parser.consume(arglist)
  File "/opt/anaconda3/lib/python3.7/site-packages/plac_core.py", line 232, in consume
    return cmd, self.func(*(args + varargs + extraopts), **kwargs)
  File "/opt/anaconda3/lib/python3.7/site-packages/sense2vec/prodigy_recipes.py", line 194, in to_patterns
    terms = set([eg["word"] for eg in examples if eg["answer"] == "accept"])
  File "/opt/anaconda3/lib/python3.7/site-packages/sense2vec/prodigy_recipes.py", line 194, in <listcomp>
    terms = set([eg["word"] for eg in examples if eg["answer"] == "accept"])
KeyError: 'word'

Teached with the following command: prodigy sense2vec.teach natu_poc_pattern resources/s2v_reddit_2015_md/ --seeds "information system,consulting services,content management,web design,merchandising,software development process,web development,systems engineering,notification,messaging,staffing,outsourcing,branding,logo design,CRM,push notifications,software services"

Extracting the patterns: prodigy sense2vec.to-patterns natu_poc_pattern en_core_web_lg PROD_SIO --output-file prod_sio_patterns.jsonl

Not sure what could've gone wrong. Thanks in advance! 😃

npattarone commented 3 years ago

Solved, was an env issue.