-
-
Notifications
You must be signed in to change notification settings - Fork 422
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How does add jieba custom dictionary? #4
Comments
Hi, you may refer to the following instructions from jieba, and add the corresponding code with your own dictionary in
From jieba: 载入词典 开发者可以指定自己自定义的词典,以便包含 jieba 词库里没有的词。虽然 jieba 有新词识别能力,但是自行添加新词可以保证更高的正确率 |
能提供一个从配置文件加载的方法么?谢谢。 |
@BrikerMan 最新的commit增加了配置文件加载的方法。 |
这个项目还没有跟官方的合并是吧?那我就得在这个下面写我的业务,不能直接 pip 安装 rasa nlu 实现对么。 |
@BrikerMan rasa_nlu_chi本身一直在update rasa_nlu最新的代码。现在不能merge进官方仓库的原因是rasa_nlu主框架的language control部分还有问题,长远还是要作为language support合并进去。 中文业务的话,暂时可能还是要用rasa_nlu_chi. |
嗯嗯。那就先用这个了。非常感谢。我在继续研究研究。 |
遇到个错误。
|
原因是 tokenize 方法没有 config 属性,而且也不能每次 tokenize 时候加载一次字典。加到 train 方法里面了,这样能正常跑,不过也不合理。应该在 tokenizer 初始化时候进行加载。
|
init部分好像不好加config,牵扯到整个tokenizer的init定义。 |
这个不合理是, train 时候我加载了词典,但是预测时候不会走这里。导致我训练和预测的分词不一样。每次 train 加载一次全量的字典这个倒是没问题。 |
@BrikerMan 我把import jieba从tokenizer拿出来了,防止每次运行tokenizer都要跑import。 |
@BrikerMan 明白你的意思了,inference确实是有问题。我想下怎么搞。 |
如果我自己在项目里面自定义了 pipeline, 如何注册?我用 pip 方式安装了 |
自定义pipeline只需要修改config文件就好了
你是要添加新的module吗还是? |
我添加到这里以后提示
好像是需要注册一下这个 class 否则不知道从哪里 import 这个。我想注册一个大写汉字数字转阿拉伯数字的组件。 |
新的组件是需要注册的。你可以以jieba_tokenizer为例,在项目中搜索下相关部分代码。 |
嗯嗯,这个我看到了。就是想的有没有办法在不修改 rasa 代码情况下注册。 |
关于加入jieba自定义词典,暂时没有找到非常优雅的做法。 |
關於加入jieba字典的方法,我有一些疑問 所以我專案目錄下,執行 是不在這個專案目錄下,要有jieba_userdict這個目錄,才能把字典放進去呢? 我覺得這個字典載入進去jieba程式,最好有提示(console)確定有載入,感覺有機會大家其實都沒有載入 不知道這樣我的理解有沒有錯? 謝謝!! |
@DoubleAix 谢谢你的提示,已更新代码和readme。如果你有更好的添加用户字典的方式也欢迎提出来。 |
I want to add jieba custom dictionary, which config file can do it?
The text was updated successfully, but these errors were encountered: