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 int
private IntObjectHashMap
<ArrayList<SegToken>> Map of start offsets to ArrayList of tokens at that position -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
Add aSegToken
to the mapping, creating a new mapping at the token's startOffset if one does not exist.int
Get the highest start offset in the mapgetStartList
(int s) Get the list of tokens at the specified start offsetboolean
isStartExist
(int s) Returns true if a mapping for the specified start offset existsSet theSegToken.index
for each token, based upon its order by startOffset.toString()
Return aList
of 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.index
for each token, based upon its order by startOffset.- Returns:
- a
List
of these ordered tokens.
-
addToken
Add aSegToken
to the mapping, creating a new mapping at the token's startOffset if one does not exist.- Parameters:
token
-SegToken
-
toTokenList
Return aList
of all tokens in the map, ordered by startOffset.- Returns:
List
of all tokens in the map.
-
toString
-