kuromoji_part_of_speech 分词过滤器
编辑kuromoji_part_of_speech
分词过滤器编辑
kuromoji_part_of_speech
分词过滤器会移除与一组词性标签匹配的词条。它接受以下设置
-
stoptags
- 应移除的词性标签数组。它默认为
lucene-analyzer-kuromoji.jar
中嵌入的stoptags.txt
文件。
例如
PUT kuromoji_sample { "settings": { "index": { "analysis": { "analyzer": { "my_analyzer": { "tokenizer": "kuromoji_tokenizer", "filter": [ "my_posfilter" ] } }, "filter": { "my_posfilter": { "type": "kuromoji_part_of_speech", "stoptags": [ "助詞-格助詞-一般", "助詞-終助詞" ] } } } } } } GET kuromoji_sample/_analyze { "analyzer": "my_analyzer", "text": "寿司がおいしいね" }
响应为
{ "tokens" : [ { "token" : "寿司", "start_offset" : 0, "end_offset" : 2, "type" : "word", "position" : 0 }, { "token" : "おいしい", "start_offset" : 3, "end_offset" : 7, "type" : "word", "position" : 2 } ] }