Giter Site home page Giter Site logo

自定义词典似乎没用 about hanlp HOT 4 CLOSED

hankcs avatar hankcs commented on May 18, 2024
自定义词典似乎没用

from hanlp.

Comments (4)

yuchaozhou avatar yuchaozhou commented on May 18, 2024

1.使用CustomDictionary添加新词,在粗分阶段会切分出来,没有问题。

2.问题出在ngram词频处理上。
删掉ngram缓存,你需要将"绝对@高大上"加入CoreNatureDictionary.ngram.txt中。
不过,还存在一个问题,ngram加载时,CoreBiGramTableDictionary类对产后接续词进行了是否在核心词典的检测,如果在则加载,若不在则跳过。所以,此处直接用CustomDictionary存在问题是,新添加的词并没有在核心词典,ngram接续词会跳过。

3.存在的问题或许还是需要后续开发完善的。

4.目前直接将“高大上”加入核心词典、绝对@高大上"加入CoreNatureDictionary.ngram.txt后,问题解决。

[外观/n, 绝对/d, 高大上/a, ,/w, 不信/v, 的/ude1, 是/vshi, 没/d, 见过/v, ./w]

from hanlp.

jdb110 avatar jdb110 commented on May 18, 2024

增加个CoreNatureDictionary.add的方法就好了

from hanlp.

jdb110 avatar jdb110 commented on May 18, 2024

建议:增加个CoreNatureDictionary.add的方法,CoreDictionaryPath可以向CustomDictionaryPath一样追加多个词典。

from hanlp.

hankcs avatar hankcs commented on May 18, 2024

问题的确如@yuchaozhou所言,在于缺少NGram接续。所以需要

  1. 把词加到CoreNatureDictionary.txt里
  2. 把接续加到CoreNatureDictionary.ngram.txt里

带有Core字样的是训练出来的模型,不太希望用户增删,而且双数组tire动态增删代价非常大。所以不打算实现CoreNatureDictionary.add

from hanlp.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.