PyThaiNLP / pythainlp

Thai Natural Language Processing in Python.
https://pythainlp.org/
Apache License 2.0
975 stars 272 forks source link

bug: ImportError pycrfsuite #901

Closed wannaphong closed 7 months ago

wannaphong commented 7 months ago

Description

After installed PyThaiNLP 5.0.0, It has error when call any function.

try:
    import pycrfsuite
except ImportError:
    raise ImportError("ImportError; Install pycrfsuite by pip install python-crfsuite")

Thank you @luc-languagetools for report the bug!

Expected results

Doesn't has ImportError

Current results

Can't use PyThaiNLP without install python-crfsuite

Steps to reproduce

  1. Install pythainlp by: pip install pythainlp==5.0.0
  2. use from pythainlp.tokenize import word_tokenize

PyThaiNLP version

5.0.0

Python version

3.9.0

Operating system and version

MacOS 12

More info

No response

Possible solution

Delete a code that use any python-crfsuite.

I found https://github.com/PyThaiNLP/pythainlp/blob/1e94d32f387ea26021a4d79d8781322de944959c/pythainlp/util/pronounce.py#L12 use syllable_tokenize that shouldn't use by default, so I will move all_thai_words_dict to rhyme.

Files

No response

wannaphong commented 7 months ago

Fixed!

luc-vocab commented 7 months ago

Many thanks for this prompt solution and for running this excellent project!