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
vim plugins/analysis-hanlp/data/dictionary/custom/CustomDictionary1.txt
OPPO nx 1 VIVO nx 1 IPHONE nx 1
curl -XPUT http://localhost:9200/test1 -H 'Content-Type:application/json' -d' { "settings": { "analysis": { "analyzer": { "my_hanlp_analyzer": { "tokenizer": "my_hanlp" } }, "tokenizer": { "my_hanlp": { "type": "hanlp", "enable_stop_dictionary": true, "enable_custom_config": true, "enable_custom_dictionary":true, "enable_number_quantifier_recognize":false } } } } }'
curl -XGET "http://localhost:9200/test1/_analyze" -H 'Content-Type: application/json;charset=utf-8' -d' { "text": "IPHONEOPPOVIVO", "analyzer": "my_hanlp_analyzer" }'
{"tokens":[{"token":"IPHONEOPPOVIVO","start_offset":0,"end_offset":14,"type":"nx","position":0}]}
The text was updated successfully, but these errors were encountered:
将CustomDictionary1.txt文件目录追加到hanlp.properties配置文件的CustomDictionaryPath自定义词典路径下试试,注意格式(有无空格解析逻辑是不一样的)。
Sorry, something went wrong.
我那个案例是追加了的,跳过了这部分。后面看了有英文的案例,用全角英文处理。
No branches or pull requests
自定义词库
vim plugins/analysis-hanlp/data/dictionary/custom/CustomDictionary1.txt
新建index
_analyze
curl -XGET "http://localhost:9200/test1/_analyze" -H 'Content-Type: application/json;charset=utf-8' -d'
{
"text": "IPHONEOPPOVIVO",
"analyzer": "my_hanlp_analyzer"
}'
The text was updated successfully, but these errors were encountered: