Class SegGraph
java.lang.Object
org.apache.lucene.analysis.cn.smart.hhmm.SegGraph
Graph representing possible tokens at each start offset in the sentence.
For each start offset, a list of possible tokens is stored.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate intprivate IntObjectHashMap<ArrayList<SegToken>> Map of start offsets to ArrayList of tokens at that position -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidAdd aSegTokento the mapping, creating a new mapping at the token's startOffset if one does not exist.intGet the highest start offset in the mapgetStartList(int s) Get the list of tokens at the specified start offsetbooleanisStartExist(int s) Returns true if a mapping for the specified start offset existsSet theSegToken.indexfor each token, based upon its order by startOffset.toString()Return aListof all tokens in the map, ordered by startOffset.
-
Field Details
-
tokenListTable
Map of start offsets to ArrayList of tokens at that position -
maxStart
private int maxStart
-
-
Constructor Details
-
SegGraph
SegGraph()
-
-
Method Details
-
isStartExist
public boolean isStartExist(int s) Returns true if a mapping for the specified start offset exists- Parameters:
s- startOffset- Returns:
- true if there are tokens for the startOffset
-
getStartList
Get the list of tokens at the specified start offset- Parameters:
s- startOffset- Returns:
- List of tokens at the specified start offset.
-
getMaxStart
public int getMaxStart()Get the highest start offset in the map- Returns:
- maximum start offset, or -1 if the map is empty.
-
makeIndex
Set theSegToken.indexfor each token, based upon its order by startOffset.- Returns:
- a
Listof these ordered tokens.
-
addToken
Add aSegTokento the mapping, creating a new mapping at the token's startOffset if one does not exist.- Parameters:
token-SegToken
-
toTokenList
Return aListof all tokens in the map, ordered by startOffset.- Returns:
Listof all tokens in the map.
-
toString
-