use of com.ibm.icu.text.UnicodeSet in project antlr4 by antlr.
the class UnicodeDataTemplateController method addIntPropertyRanges.
private static void addIntPropertyRanges(int property, String namePrefix, Map<String, IntervalSet> propertyCodePointRanges) {
for (int propertyValue = UCharacter.getIntPropertyMinValue(property); propertyValue <= UCharacter.getIntPropertyMaxValue(property); propertyValue++) {
UnicodeSet set = new UnicodeSet();
set.applyIntPropertyValue(property, propertyValue);
String propertyName = namePrefix + UCharacter.getPropertyValueName(property, propertyValue, UProperty.NameChoice.SHORT);
IntervalSet intervalSet = propertyCodePointRanges.get(propertyName);
if (intervalSet == null) {
intervalSet = new IntervalSet();
propertyCodePointRanges.put(propertyName, intervalSet);
}
addUnicodeSetToIntervalSet(set, intervalSet);
}
}
use of com.ibm.icu.text.UnicodeSet in project antlr4 by antlr.
the class UnicodeDataTemplateController method addEmojiPresentationPropertyCodesToCodePointRanges.
private static void addEmojiPresentationPropertyCodesToCodePointRanges(Map<String, IntervalSet> propertyCodePointRanges) {
UnicodeSet emojiDefaultUnicodeSet = new UnicodeSet("[[\\p{Emoji=Yes}]&[\\p{Emoji_Presentation=Yes}]]");
IntervalSet emojiDefaultIntervalSet = new IntervalSet();
addUnicodeSetToIntervalSet(emojiDefaultUnicodeSet, emojiDefaultIntervalSet);
propertyCodePointRanges.put("EmojiPresentation=EmojiDefault", emojiDefaultIntervalSet);
UnicodeSet textDefaultUnicodeSet = new UnicodeSet("[[\\p{Emoji=Yes}]&[\\p{Emoji_Presentation=No}]]");
IntervalSet textDefaultIntervalSet = new IntervalSet();
addUnicodeSetToIntervalSet(textDefaultUnicodeSet, textDefaultIntervalSet);
propertyCodePointRanges.put("EmojiPresentation=TextDefault", textDefaultIntervalSet);
UnicodeSet textUnicodeSet = new UnicodeSet("[\\p{Emoji=No}]");
IntervalSet textIntervalSet = new IntervalSet();
addUnicodeSetToIntervalSet(textUnicodeSet, textIntervalSet);
propertyCodePointRanges.put("EmojiPresentation=Text", textIntervalSet);
}
use of com.ibm.icu.text.UnicodeSet in project lucene-solr by apache.
the class TestICUTransformFilter method testOptimizer.
public void testOptimizer() throws Exception {
// convert a's to b's and b's to c's
String rules = "a > b; b > c;";
Transliterator custom = Transliterator.createFromRules("test", rules, Transliterator.FORWARD);
assertTrue(custom.getFilter() == null);
final KeywordTokenizer input = new KeywordTokenizer();
input.setReader(new StringReader(""));
new ICUTransformFilter(input, custom);
assertTrue(custom.getFilter().equals(new UnicodeSet("[ab]")));
}
Aggregations