wear / harmonious_dictionary Goto Github PK
View Code? Open in Web Editor NEWFilter any words that need to be harmonized
License: MIT License
Filter any words that need to be harmonized
License: MIT License
目前是采用读取配置文件的方式, 当有以下场景时, 有点麻烦:
希望能支持从 MySQL 或者 redis 读取敏感词
例如:
ddddddd中文敏感词eeeee
这个时候“中文敏感词”不会被检测到。
#2 带来一个新的问题, 使用说明里面的字典, 如果在Spec加入这个case, 会失败。
it 'should check this word' do
HarmoniousDictionary.harmonious_words('代开普通发票是什么').should == ['代开普通发票']
end
原因是因为 rseg.rb 的第87行 word = '' if engine.class == English && !@english_dictionary.include?(word) , 第一个engine把word覆盖成“代开普通发票”, 第二个又把结果覆盖成""
等到了下面check no match的时候, 就已经找不到这个词了。
revert掉这个patch就可以pass这个case
因为两个engine的结果应该是有可能互相覆盖的, 所以最好nomatch 和 word的结果应该用存在一个dict里面, 各保持各得。
但是我做了这个改动以后发现会一直循环在最后一个“非”不和谐词里面, 比如
it 'should find harmonious chinese words' do
HarmoniousDictionary.clean?('李XX在**').should == false
end
这个case就是会一直在“在” 那里循环。。。
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.