Class LengthGoalBreakIterator
java.lang.Object
java.text.BreakIterator
org.apache.lucene.search.uhighlight.LengthGoalBreakIterator
- All Implemented Interfaces:
Cloneable
Wraps another
BreakIterator to skip past breaks that would result in passages that are
too short. It's still possible to get a short passage but only at the very end of the input text.
Important: This is not a general purpose BreakIterator; it's only designed to work in
a way compatible with the UnifiedHighlighter. Some assumptions are checked with Java
assertions.
- WARNING: This API is experimental and might change in incompatible ways in the next release.
-
Field Summary
Fields inherited from class java.text.BreakIterator
DONE -
Method Summary
Modifier and TypeMethodDescriptionclone()static LengthGoalBreakIteratorcreateClosestToLength(BreakIterator baseIter, int targetLength, float fragmentAlignment) Breaks will be on averagetargetLengthapart; the closest break to this target (before or after) is chosen.static LengthGoalBreakIteratorcreateMinLength(BreakIterator baseIter, int minLength, float fragmentAlignment) Breaks will be at leastminLengthapart (to the extent possible), while trying to position the match inside the fragment according tofragmentAlignment.intcurrent()intfirst()intfollowing(int matchEndIndex) getText()booleanisBoundary(int offset) intlast()intnext()intnext(int n) intpreceding(int matchStartIndex) intprevious()voidvoidsetText(CharacterIterator newText) toString()Methods inherited from class java.text.BreakIterator
getAvailableLocales, getCharacterInstance, getCharacterInstance, getLineInstance, getLineInstance, getSentenceInstance, getSentenceInstance, getWordInstance, getWordInstance
-
Method Details
-
createMinLength
public static LengthGoalBreakIterator createMinLength(BreakIterator baseIter, int minLength, float fragmentAlignment) Breaks will be at leastminLengthapart (to the extent possible), while trying to position the match inside the fragment according tofragmentAlignment. -
createClosestToLength
public static LengthGoalBreakIterator createClosestToLength(BreakIterator baseIter, int targetLength, float fragmentAlignment) Breaks will be on averagetargetLengthapart; the closest break to this target (before or after) is chosen. The match will be positioned according tofragmentAlignmentas much as possible. -
toString
-
clone
- Overrides:
clonein classBreakIterator
-
getText
- Specified by:
getTextin classBreakIterator
-
setText
- Overrides:
setTextin classBreakIterator
-
setText
- Specified by:
setTextin classBreakIterator
-
current
public int current()- Specified by:
currentin classBreakIterator
-
first
public int first()- Specified by:
firstin classBreakIterator
-
last
public int last()- Specified by:
lastin classBreakIterator
-
next
public int next(int n) - Specified by:
nextin classBreakIterator
-
next
public int next()- Specified by:
nextin classBreakIterator
-
previous
public int previous()- Specified by:
previousin classBreakIterator
-
following
public int following(int matchEndIndex) - Specified by:
followingin classBreakIterator
-
preceding
public int preceding(int matchStartIndex) - Overrides:
precedingin classBreakIterator
-
isBoundary
public boolean isBoundary(int offset) - Overrides:
isBoundaryin classBreakIterator
-