Package org.lionsoul.jcseg.segmenter
Class DetectSeg
- java.lang.Object
-
- org.lionsoul.jcseg.segmenter.DetectSeg
-
- All Implemented Interfaces:
Serializable,ISegment
public class DetectSeg extends Object implements ISegment, Serializable
Detect segmentation mode return words only in the loaded dictionary yat, when matched a word and return it or continue to find the next word in the dictionary
- Since:
- 1.9.4
- Author:
- chenxin
- See Also:
- Serialized Form
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.lionsoul.jcseg.ISegment
ISegment.Type
-
-
Field Summary
Fields Modifier and Type Field Description SegmenterConfigconfigADictionarydicthe dictionary and task configurationprotected LinkedList<IWord>wordPool-
Fields inherited from interface org.lionsoul.jcseg.ISegment
CHECK_CE_MASk, CHECK_CF_MASK, CHECK_EC_MASK, COMPLEX, COMPLEX_MODE, DELIMITER, DELIMITER_MODE, DETECT, DETECT_MODE, MOST, MOST_MODE, NGRAM, NGRAM_MODE, NLP, NLP_MODE, SIMPLE, SIMPLE_MODE, START_SS_MASK
-
-
Constructor Summary
Constructors Constructor Description DetectSeg(SegmenterConfig config, ADictionary dic)method to create a new ISegment
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description SegmenterConfiggetConfig()get the current task config instanceADictionarygetDict()get the current dictionary instanceintgetStreamPosition()get the current length of the streamIWordnext()segment a word from a char array from a specified position.protected voidpushBack(int data)push back the data to the streamprotected intreadNext()read the next char from the current positionvoidreset(Reader input)reset the reader
-
-
-
Field Detail
-
wordPool
protected final LinkedList<IWord> wordPool
-
dic
public final ADictionary dic
the dictionary and task configuration
-
config
public final SegmenterConfig config
-
-
Constructor Detail
-
DetectSeg
public DetectSeg(SegmenterConfig config, ADictionary dic)
method to create a new ISegment- Parameters:
config-dic-
-
-
Method Detail
-
reset
public void reset(Reader input) throws IOException
Description copied from interface:ISegmentreset the reader- Specified by:
resetin interfaceISegment- Throws:
IOException- See Also:
ISegment.reset(Reader)
-
getStreamPosition
public int getStreamPosition()
Description copied from interface:ISegmentget the current length of the stream- Specified by:
getStreamPositionin interfaceISegment- See Also:
ISegment.getStreamPosition()
-
readNext
protected int readNext() throws IOExceptionread the next char from the current position- Returns:
- int
- Throws:
IOException
-
pushBack
protected void pushBack(int data)
push back the data to the stream- Parameters:
data-
-
getDict
public ADictionary getDict()
get the current dictionary instance- Returns:
- ADictionary
-
getConfig
public SegmenterConfig getConfig()
get the current task config instance
-
next
public IWord next() throws IOException
Description copied from interface:ISegmentsegment a word from a char array from a specified position.- Specified by:
nextin interfaceISegment- Returns:
- IWord or null
- Throws:
IOException- See Also:
ISegment.next()
-
-