text-normalization

Programatic Accent Reduction in JavaScript (aka text normalization or unaccenting)

[亡魂溺海] 提交于 2019-11-26 18:30:36
I need to compare 2 strings as equal such as these: Lubeck == Lübeck In JavaScript. Why? Well, I have an auto-completion field that's going out to a Java service using Lucene, where place names are stored naturally (as Lübeck), but also indexed as normalized text, import sun.text.Normalizer; oDoc.setNameLC = Normalizer.normalize(oLocName, Normalizer.DECOMP, 0) .toLowerCase().replaceAll("[^\\p{ASCII}]",""); This way some-one who doesn't know to type "Mèxico" can type "mexico" and get a match which returns "Mèxico" (among a lot of other possible hits, like "Café Mèxico, Dubai, UAE"). Now the

Programatic Accent Reduction in JavaScript (aka text normalization or unaccenting)

半腔热情 提交于 2019-11-26 06:24:53
问题 I need to compare 2 strings as equal such as these: Lubeck == Lübeck In JavaScript. Why? Well, I have an auto-completion field that\'s going out to a Java service using Lucene, where place names are stored naturally (as Lübeck), but also indexed as normalized text, import sun.text.Normalizer; oDoc.setNameLC = Normalizer.normalize(oLocName, Normalizer.DECOMP, 0) .toLowerCase().replaceAll(\"[^\\\\p{ASCII}]\",\"\"); This way some-one who doesn\'t know to type \"Mèxico\" can type \"mexico\" and