infinilabs / analysis-pinyin

🛵 This Pinyin Analysis plugin is used to do conversion between Chinese characters and Pinyin.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

单韵母开头的中文如“阿莫西林” “鹅” 拼音首字母分析不出来

t163ang opened this issue · comments

设置如下:
{
"type" : "pinyin",
"keep_first_letter": false,
"keep_separate_first_letter" : true,
"keep_full_pinyin" : false,
"keep_original" : false,
"limit_first_letter_length" : 16,
"lowercase" : true,
"remove_duplicated_term" : false,
"ignore_pinyin_offset": false
}
对阿莫西林进行分析:
{
"tokens": [
{
"token": "m",
"start_offset": 1,
"end_offset": 2,
"type": "word",
"position": 1
},
{
"token": "x",
"start_offset": 2,
"end_offset": 3,
"type": "word",
"position": 2
},
{
"token": "l",
"start_offset": 3,
"end_offset": 4,
"type": "word",
"position": 3
}
]
}
发现漏掉第一个中文阿“a”拼音首字母

commented

代码里写的是 config.keepSeparateFirstLetter & pinyin.length() > 1,才会生成首字母的拼音,在 keepFullPinyin=false 的情况下,感觉有点问题