Package net.loomchild.segment.srx.legacy
Class AccurateSrxTextIterator
- java.lang.Object
-
- net.loomchild.segment.AbstractTextIterator
-
- net.loomchild.segment.srx.legacy.AccurateSrxTextIterator
-
- All Implemented Interfaces:
java.util.Iterator<java.lang.String>
,TextIterator
public class AccurateSrxTextIterator extends AbstractTextIterator
Reprezentuje splitter dzielący na podstawie reguł zawartych w pliku srx.
-
-
Field Summary
Fields Modifier and Type Field Description private int
endPosition
private java.util.List<LanguageRule>
languageRuleList
private java.util.List<RuleMatcher>
ruleMatcherList
private java.lang.String
segment
private int
startPosition
private java.lang.CharSequence
text
-
Constructor Summary
Constructors Constructor Description AccurateSrxTextIterator(SrxDocument document, java.lang.String languageCode, java.lang.CharSequence text)
Creates text iterator that obtains language rules form given document using given language code.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private void
cutMatchers()
Move matchers that start before previous segment end.private RuleMatcher
getMinMatcher()
boolean
hasNext()
private void
initMatchers()
private void
moveMatchers()
Przesuwa iteratory na kolejną pozycje jeśli to konieczne.java.lang.String
next()
Wyszukuje następne dopasowanie.-
Methods inherited from class net.loomchild.segment.AbstractTextIterator
remove, toString
-
-
-
-
Field Detail
-
languageRuleList
private java.util.List<LanguageRule> languageRuleList
-
text
private java.lang.CharSequence text
-
segment
private java.lang.String segment
-
ruleMatcherList
private java.util.List<RuleMatcher> ruleMatcherList
-
startPosition
private int startPosition
-
endPosition
private int endPosition
-
-
Constructor Detail
-
AccurateSrxTextIterator
public AccurateSrxTextIterator(SrxDocument document, java.lang.String languageCode, java.lang.CharSequence text)
Creates text iterator that obtains language rules form given document using given language code. To retrieve language rules callsSrxDocument.getLanguageRuleList(String)
.- Parameters:
document
- document containing language ruleslanguageCode
- language code to select the rulestext
-
-
-
Method Detail
-
next
public java.lang.String next()
Wyszukuje następne dopasowanie.- Returns:
- Zwraca następny segment albo null jeśli nie istnieje
- Throws:
IOSRuntimeException
- Zgłaszany gdy nastąpi błąd przy odczycie strumienia
-
hasNext
public boolean hasNext()
- Returns:
- Zwraca true gdy są dostępne kolejne segmenty
-
initMatchers
private void initMatchers()
-
moveMatchers
private void moveMatchers()
Przesuwa iteratory na kolejną pozycje jeśli to konieczne.
-
cutMatchers
private void cutMatchers()
Move matchers that start before previous segment end.
-
getMinMatcher
private RuleMatcher getMinMatcher()
- Returns:
- Zwraca iterator pierwszego trafionego dopasowania
-
-