public ICUCharacterBreaker(Locale locale) { this.breaker = BreakIterator.getCharacterInstance(locale); }
public ICUCharacterBreaker(Locale locale) { this.breaker = BreakIterator.getCharacterInstance(locale); }
/** * Returns a new instance of BreakIterator that locates logical-character * boundaries. This function assumes that the text being analyzed is * in the default locale's language. * @return A new instance of BreakIterator that locates logical-character * boundaries. * @stable ICU 2.0 */ public static BreakIterator getCharacterInstance() { return getCharacterInstance(Locale.getDefault()); }
/** * Returns a new instance of BreakIterator that locates logical-character * boundaries. This function assumes that the text being analyzed is * in the default locale's language. * @return A new instance of BreakIterator that locates logical-character * boundaries. * @stable ICU 2.0 */ public static BreakIterator getCharacterInstance() { return getCharacterInstance(Locale.getDefault()); }
/** * Returns a new instance of BreakIterator that locates logical-character * boundaries. This function assumes that the text being analyzed is * in the default locale's language. * @return A new instance of BreakIterator that locates logical-character * boundaries. * @stable ICU 2.0 */ public static BreakIterator getCharacterInstance() { return getCharacterInstance(ULocale.getDefault()); }
@Override public BreakIterator getCharacterInstance(Locale locale) { com.ibm.icu.text.BreakIterator icuBrkItr = com.ibm.icu.text.BreakIterator.getCharacterInstance( ICULocaleServiceProvider.toULocaleNoSpecialVariant(locale)); return BreakIteratorICU.wrap(icuBrkItr); }
private BreakIterator createBreakIterator() { ULocale locale = ULocale.forLanguageTag(this.locale); if ("line".equals(granularity)) { // "strictness" cannot be set through unicode extensions (u-lb-strict), handle here: locale = locale.setKeywordValue("lb", strictness); } BreakIterator breakIterator; switch (granularity) { case "grapheme": breakIterator = BreakIterator.getCharacterInstance(locale); break; case "word": breakIterator = BreakIterator.getWordInstance(locale); break; case "sentence": breakIterator = BreakIterator.getSentenceInstance(locale); break; case "line": breakIterator = BreakIterator.getLineInstance(locale); break; default: throw new AssertionError(); } return breakIterator; }
bitr = BreakIterator.getCharacterInstance(brkLocale); break; case BI_TITLE:
/** * Sets the {@link RuleBasedCollator} to be used for language-specific searching. * <p> * The iterator's position will not be changed by this method. * @param collator to use for this <tt>StringSearch</tt> * @throws IllegalArgumentException thrown when collator is null * @see #getCollator * @stable ICU 2.0 */ public void setCollator(RuleBasedCollator collator) { if (collator == null) { throw new IllegalArgumentException("Collator can not be null"); } collator_ = collator; ceMask_ = getMask(collator_.getStrength()); ULocale collLocale = collator.getLocale(ULocale.VALID_LOCALE); search_.internalBreakIter_ = BreakIterator.getCharacterInstance(collLocale == null ? ULocale.ROOT : collLocale); search_.internalBreakIter_.setText((CharacterIterator)search_.text().clone()); // We need to create a clone toShift_ = collator.isAlternateHandlingShifted(); variableTop_ = collator.getVariableTop(); textIter_ = new CollationElementIterator(pattern_.text_, collator); utilIter_ = new CollationElementIterator(pattern_.text_, collator); // initialize() _after_ setting the iterators for the new collator. initialize(); }
int documentLength= document.getLength(); int offset= 0; BreakIterator charBreakIterator= BreakIterator.getCharacterInstance(); charBreakIterator.setText(document.get()); while (offset < documentLength) {
search_.internalBreakIter_ = BreakIterator.getCharacterInstance(collLocale == null ? ULocale.ROOT : collLocale);