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 } ] }