fix(common/lmlayer): correct Unicode range in default key fn

This commit is contained in:
Eddie Antonio Santos 2020-04-06 10:24:33 -06:00 committed by jahorton
parent 36c5f956b9
commit c33524e078

View file

@ -429,7 +429,10 @@
*/
function defaultWordform2Key(wordform: string): SearchKey {
return wordform
.replace(/[\u0100-\u2200]/g, function (c) {
// remove all combining diacritics (if input is in NFD)
.replace(/[\u0300-\u036f]/g, '')
// remove all composed diacritics (if input is in NFC) LATIN-ONLY!
.replace(/[\u00C0-\u212A]/g, function (c) {
if (c in PARTIAL_NFD_LOOKUP) {
return PARTIAL_NFD_LOOKUP[c];
}