我一直在尝试练习从本教程中学到的知识:(https://realpython.com/sentiment-analysis-python/ https://realpython.com/sentiment-analysis-python/)使用 PyCharm。
还有这一行:
textcat.add_label("pos")
生成警告:在“(Doc) -> Doc | ”中找不到引用“add_label” (文档)-> 文档'
我明白这是因为“nlp.create_pipe()" 生成一个 Doc 而不是字符串,但是(本质上是因为我不知道在这种情况下该怎么做!)无论如何我都运行了脚本,但后来我从这一行得到了一个错误:
textcat = nlp.create_pipe("textcat", config={"architecture": "simple_cnn"})
错误消息:
raise ConfigValidationError(
thinc.config.ConfigValidationError:
Config validation error
textcat -> 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'}
我在用着:
- Pycharm v:2019.3.4
- 蟒蛇五:3.8.6
- spaCy v:3.0.5