如何修复 pymorphy 库中的“TypeError: super(type, obj): obj must be an instance or subtype of type”?

问题描述 投票:0回答:0

我需要标记文本。我决定使用 pymorphy2 库,但是在尝试创建

MorphAnalyzer()
对象时,它会抛出错误

TypeError: super(type, obj): obj must be an instance or subtype of type.

import pymorphy2
morph = pymorphy2.MorphAnalyzer()

完整的错误日志:

Traceback (most recent call last):

  File "C:\Users\alexh1n11\Desktop\script\example_script2.py", line 35, in <module>
    morph = pymorphy2.MorphAnalyzer()

  File "C:\Users\alexh1n11\AppData\Roaming\Python\Python39\site-packages\pymorphy2\analyzer.py", line 203, in __init__
    self.dictionary = opencorpora_dict.Dictionary(path)

  File "C:\Users\alexh1n11\AppData\Roaming\Python\Python39\site-packages\pymorphy2\opencorpora_dict\wrapper.py", line 18, in __init__
    self._data = load_dict(path)

  File "C:\Users\alexh1n11\AppData\Roaming\Python\Python39\site-packages\pymorphy2\opencorpora_dict\storage.py", line 59, in load_dict
    words = dawg.WordsDawg().load(_f('words.dawg'))

  File "C:\Users\alexh1n11\AppData\Roaming\Python\Python39\site-packages\pymorphy2\dawg.py", line 32, in __init__
    super(WordsDawg, self).__init__(self.DATA_FORMAT)

  File "C:\Users\alexh1n11\AppData\Roaming\Python\Python39\site-packages\dawg_python\dawgs.py", line 417, in __init__
    super(RecordDAWG, self).__init__(payload_separator)

TypeError: super(type, obj): obj must be an instance or subtype of type

使用pymorphy3库时问题完全一样

python-3.x nlp tokenize
© www.soinside.com 2019 - 2024. All rights reserved.