AttributeError: module ‘hanlp.utils.rules‘ has no attribute ‘tokenize_english‘

附原文链接:http://t.csdnimg.cn/wVLib

  1. import hanlp

  2. tokenizer = hanlp.utils.rules.tokenize_english

  3. tokenizer('Mr. Hankcs bought hankcs.com for 1.5 thousand dollars.')

  4. 改为:

  5. from hanlp.utils.lang.en.english_tokenizer import tokenize_english
    tokenizer = tokenize_english
    tokenizer('Mr. Hankcs bought hankcs.com for 1.5 thousand dollars.')

Python 版本为 3.8.10

你可能感兴趣的:(python,经验分享,nlp)