nlp icon indicating copy to clipboard operation
nlp copied to clipboard

Incompatible with spaCy 3.5.3

Open davidcrossey opened this issue 2 years ago • 1 comments

This is similar to issue #17.

evaluation error:

call: [E966] `nlp.add_pipe` now takes the string name of the registered component factory, not a callable component. Expected string, but got  (name: 'None').

- If you created your component with `nlp.create_pipe('name')`: remove nlp.create_pipe and call `nlp.add_pipe('name')` instead.

- If you passed in a component like `TextCategorizer()`: call `nlp.add_pipe` with the string name instead, e.g. `nlp.add_pipe('textcat')`.

- If you're using a custom component: Add the decorator `@Language.component` (for function components) or `@Language.factory` (for class components / factories) to your custom component and assign it a name, e.g. `@Language.component('your_name')`. You can then run `nlp.add_pipe('your_name')` to add it to the pipeline.

  [4]  /home/david/miniconda3/envs/nlp/q/p.q:38: .p.embedPy:
        '`NYI];
      wrap pyfunc[f]. x];
                    ^
    ":"~first a0:string x0;                                                / attr lookup and possible call

  [3]  /home/david/miniconda3/envs/nlp/q/p.q:46: .p.i.wf:{[f;x]embedPy[f;x]}
                                                               ^

  [2]  /home/david/miniconda3/envs/nlp/q/nlp/code/parser.q:86: .nlp.parser.i.newSubParser:
    pipe:$[`~checkLang;model[`:create_pipe;`sentencizer];.p.pyget`x_sbd];
    model[`:add_pipe]pipe;
    ^
    ];

  [1]  /home/david/miniconda3/envs/nlp/q/nlp/code/nlpCode.q:65: .nlp.newParser:
  disabled:`ner`tagger`parser except options;
  model:parser.i.newSubParser[spacyModel;options;disabled];
        ^
  tokenAttrs:parser.i.q2spacy key[parser.i.q2spacy]inter options;

  [0]  myparser:.nlp.newParser[`en_core_web_sm;`text`tokens`lemmas`pennPOS`isStop`sentChars`starts`sentIndices`keywords] 
                ^

image

Changed the following line in parser.q for parser.i.newSubParser to resolve on my end: From:

if[`sbd in options;
    pipe:$[`~checkLang;model[`:create_pipe;`sentencizer];.p.pyget`x_sbd];
    model[`:add_pipe]pipe;
    ];

To:

if[`sbd in options;$[`~checkLang;model[`:add_pipe;`sentencizer];model[`:add_pipe].p.pyget`x_sbd]];

image

davidcrossey avatar Jun 28 '23 14:06 davidcrossey

Side note: en is no longer supported, requiring the full form en_core_web_sm

davidcrossey avatar Jun 28 '23 15:06 davidcrossey