Comments (6)
是不让包含这个短语的结果搜出来,还是需要搜出来只是替换成***之类的?
from elasticsearch-analysis-ansj.
是不让包含这个短语的结果搜出来,还是需要搜出来只是替换成***之类的?
不让他搜出来
并且把这个短语弄成读取文件的方式
from elasticsearch-analysis-ansj.
可以在搜索的时候,加must_not过滤掉
from elasticsearch-analysis-ansj.
可以在搜索的时候,加must_not过滤掉
那不是得写很长过滤条件,我主要是对结果过滤,屏蔽短语
from elasticsearch-analysis-ansj.
如果短语很多,
如果变化不频繁,可以考虑写索引的时候放进去,这样搜索的时候直接用这个字段来过滤
如果变化频繁,可以在获取到结果集之后,程序里处理
from elasticsearch-analysis-ansj.
从内容里提取短语,参考:
词典dic_xxx内容:
战天下 a 1000
天下大乱 a 2000
示例:
import org.ansj.library.DicLibrary;
import org.nlpcn.commons.lang.tire.GetWord;
import org.nlpcn.commons.lang.tire.domain.Forest;
import java.util.Arrays;
public class Test {
public static void main(String[] args) {
Forest forest = DicLibrary.get("dic_xxx");
GetWord gw = forest.getWord("如何实现短语屏蔽功能:天下大乱,云长战吕布,吕布大战天下");
String word;
while ((word = gw.getAllWords()) != null) {
System.out.println(word + "============" + Arrays.toString(gw.getParam()));
}
}
}
输出:
天下大乱============[a, 2000]
战天下============[a, 1000]
from elasticsearch-analysis-ansj.
Related Issues (20)
- elasticsearch6.4.0如何配置mysql方式的热加载词典 HOT 3
- 7.8 ansj 插件的实现是不是有点过时了
- 配置自定义字典为jdbc方式,启动elasticsearch后报错 HOT 5
- 配置自定义词典都没有成功是什么原因 HOT 1
- 7.6.2.0版本 HOT 11
- ansj.cfg.yml HOT 2
- 配置中文停用词不生效 HOT 1
- 2.4.5版本中flush/dic接口奇怪现象 HOT 9
- 除修改config/ansj.cfg.yml添加自定义词典,还有其他方式添加自定义词典吗? HOT 8
- 怎么在插件中加载自己训练的crf模型 HOT 1
- 使用自定义停用词库后报错 HOT 1
- 请问后续能支持8.4.1版本吗?8.3.3版本安装不上 HOT 4
- 8.3.3版本的包各种报错 HOT 1
- 7.10.x版本支持 HOT 1
- 7.17.9版本支持 HOT 2
- 8.7.0版本配置完自定义词典后,分词报error HOT 2
- 如何热更新词语 HOT 1
- 8.7.1版本 _analyze 报错 HOT 2
- es8.8.2配置分词不生效 HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from elasticsearch-analysis-ansj.