https://www.ogis-ri.co.jp/otc/hiroba/technical/similar-document-search/part6.html#fn6
https://qiita.com/tchih11/items/e1856225ee611cf1af83
上記サイトを参考にginzaを使おうとしているのですが、nlp = spacy.load('ja_ginza')
の部分でTypeError: create_lemmatizer() got an unexpected keyword argument 'lookups
エラーが発生します。
ソースコード
%%capture !pip install scattertext !pip install ginza !pip install neologdn # データセット作成時に使用 # GiNZAを使用するためのおまじない import pkg_resources, imp imp.reload(pkg_resources) import spacy nlp = spacy.load('ja_ginza') docs = list(nlp.pipe(texts, disable=['ner']))
エラーメッセージ全文
--------------------------------------------------------------------------- TypeError Traceback (most recent call last) <ipython-input-15-0bfa42420a02> in <module>() 1 import spacy ----> 2 nlp = spacy.load('ja_ginza') 3 docs = list(nlp.pipe(texts, disable=['ner'])) 7 frames /usr/local/lib/python3.7/dist-packages/spacy/language.py in create_vocab(cls, nlp) 67 suffix_search = ( 68 util.compile_suffix_regex(cls.suffixes).search if cls.suffixes else None ---> 69 ) 70 infix_finditer = ( 71 util.compile_infix_regex(cls.infixes).finditer if cls.infixes else None TypeError: create_lemmatizer() got an unexpected keyword argument 'lookups
やったこと1
pip install -U spacy==2.1.8へのダウングレード
→依存関係エラー
ERROR: pip's dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts. en-core-web-sm 2.2.5 requires spacy>=2.2.2, but you have spacy 2.1.8 which is incompatible.
やったこと2
pip install -U ginza
→OSError
/usr/local/lib/python3.7/dist-packages/spacy/util.py in load_config(path, overrides, interpolate) 569 else: 570 if not config_path or not config_path.exists() or not config_path.is_file(): --> 571 raise IOError(Errors.E053.format(path=config_path, name="config.cfg")) 572 return config.from_disk( 573 config_path, overrides=overrides, interpolate=interpolate OSError: [E053] Could not read config.cfg from /usr/local/lib/python3.7/dist-packages/ja_ginza/ja_ginza-2.1.0/config.cfg
回答1件
あなたの回答
tips
プレビュー