We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
请确认下列注意事项:
当前最新版本号是:1.7.5 我使用的版本是:1.7.4
CoreStopWordDictionary.add() 如何将停用词写入stopwords.txt? 还是说只能手动修改stopword.txt或者用文件流的方式。
public class DemoStopWord { public static void main(String[] args) throws Exception { System.out.println(CoreStopWordDictionary.contains("一起")); stopwords(); add(); stopwords(); } public static void add() { boolean add = CoreStopWordDictionary.add("一起"); CoreStopWordDictionary.reload(); System.out.println("add = " + add); } public static void stopwords() throws Exception { String con = "我们一起去逛超市,我们先去城西银泰,我们再去城南银泰。然后我们再一起回家"; List<String> strings = HanLP.extractKeyword(con, 5); System.out.println("strings = " + strings); } }
我期望是调用CoreStopWordDictionary.add("一起");后,将停用词"一起"加入停用词词典。然后调用CoreStopWordDictionary.reload();重新加载字典和缓存达到动态修改停用词词典的功能。
false strings = [一起, 银泰, 城, 再, 西] add = true strings = [城, 西, 银泰, 先, 再]
CoreStopWordDictionary.add("一起");并没有将“一起”写入停用词词典,只是在内存中。调用CoreStopWordDictionary.reload();以后停用词字典里没有“一起”
false strings = [一起, 银泰, 城, 再, 西] add = true strings = [一起, 银泰, 城, 再, 西]
所以说现在还是要手动修改stopword.txt或者是使用文件流的形式来修改对么?那CoreStopWordDictionary.add()和CoreStopWordDictionary.remove()这两个方法应该怎么用?
The text was updated successfully, but these errors were encountered:
开放 CoreStopWordDictionary.dictionary #1356
651382d
目前不支持序列化,你需要遍历 CoreStopWordDictionary.dictionary 存到你想存的地方。
Sorry, something went wrong.
好的 谢谢
a57645c
开放 CoreStopWordDictionary.dictionary hankcs/HanLP#1356
7dc3cc0
No branches or pull requests
注意事项
请确认下列注意事项:
版本号
当前最新版本号是:1.7.5
我使用的版本是:1.7.4
我的问题
CoreStopWordDictionary.add() 如何将停用词写入stopwords.txt?
还是说只能手动修改stopword.txt或者用文件流的方式。
复现问题
步骤
触发代码
期望输出
我期望是调用CoreStopWordDictionary.add("一起");后,将停用词"一起"加入停用词词典。然后调用CoreStopWordDictionary.reload();重新加载字典和缓存达到动态修改停用词词典的功能。
实际输出
CoreStopWordDictionary.add("一起");并没有将“一起”写入停用词词典,只是在内存中。调用CoreStopWordDictionary.reload();以后停用词字典里没有“一起”
其他信息
所以说现在还是要手动修改stopword.txt或者是使用文件流的形式来修改对么?那CoreStopWordDictionary.add()和CoreStopWordDictionary.remove()这两个方法应该怎么用?
The text was updated successfully, but these errors were encountered: