I've been trying to practise what I've learned from this tutorial:(https://realpython.com/sentiment-analysis-python/) using PyCharm.
And this line:
textcat.add_label("pos")
generated a warning: Cannot find reference 'add_label' in '(Doc) -> Doc | (Doc) -> Doc'
I understand that this is because "nlp.create_pipe()" generates a Doc not a string, but (essentially because I don't know what to do in this case!) I ran the script anyway, but then I got the an error from this line:
textcat = nlp.create_pipe("textcat", config={"architecture": "simple_cnn"})
Error msg:
raise ConfigValidationError(
thinc.config.ConfigValidationError:Config validation errortextcat -> architecture extra fields not permitted{'nlp': <spacy.lang.en.English object at 0x0000015E74F625E0>, 'name': 'textcat', 'architecture': 'simple_cnn', 'model': {'@architectures': 'spacy.TextCatEnsemble.v2', 'linear_model': {'@architectures': 'spacy.TextCatBOW.v1', 'exclusive_classes': True, 'ngram_size': 1, 'no_output_layer': False}, 'tok2vec': {'@architectures': 'spacy.Tok2Vec.v2', 'embed': {'@architectures': 'spacy.MultiHashEmbed.v1', 'width': 64, 'rows': [2000, 2000, 1000, 1000, 1000, 1000], 'attrs': ['ORTH', 'LOWER', 'PREFIX', 'SUFFIX', 'SHAPE', 'ID'], 'include_static_vectors': False}, 'encode': {'@architectures': 'spacy.MaxoutWindowEncoder.v2', 'width': 64, 'window_size': 1, 'maxout_pieces': 3, 'depth': 2}}}, 'threshold': 0.5, '@factories': 'textcat'}
I'm using:
- Pycharm v: 2019.3.4
- python v: 3.8.6
- spaCy v: 3.0.5