Class BiSegGraph
- java.lang.Object
-
- org.apache.lucene.analysis.cn.smart.hhmm.BiSegGraph
-
class BiSegGraph extends java.lang.Object
Graph representing possible token pairs (bigrams) at each start offset in the sentence.For each start offset, a list of possible token pairs is stored.
-
-
Field Summary
Fields Modifier and Type Field Description private static BigramDictionary
bigramDict
private java.util.List<SegToken>
segTokenList
private java.util.Map<java.lang.Integer,java.util.ArrayList<SegTokenPair>>
tokenPairListTable
-
Constructor Summary
Constructors Constructor Description BiSegGraph(SegGraph segGraph)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addSegTokenPair(SegTokenPair tokenPair)
Add aSegTokenPair
private void
generateBiSegGraph(SegGraph segGraph)
java.util.List<SegToken>
getShortPath()
Find the shortest path with the Viterbi algorithm.int
getToCount()
Get the number ofSegTokenPair
entries in the table.java.util.List<SegTokenPair>
getToList(int to)
Return aList
of all token pairs at this offset (index of the second token)boolean
isToExist(int to)
Returns true if their is a list of token pairs at this offset (index of the second token)java.lang.String
toString()
-
-
-
Field Detail
-
tokenPairListTable
private java.util.Map<java.lang.Integer,java.util.ArrayList<SegTokenPair>> tokenPairListTable
-
segTokenList
private java.util.List<SegToken> segTokenList
-
bigramDict
private static BigramDictionary bigramDict
-
-
Constructor Detail
-
BiSegGraph
public BiSegGraph(SegGraph segGraph)
-
-
Method Detail
-
generateBiSegGraph
private void generateBiSegGraph(SegGraph segGraph)
-
isToExist
public boolean isToExist(int to)
Returns true if their is a list of token pairs at this offset (index of the second token)- Parameters:
to
- index of the second token in the token pair- Returns:
- true if a token pair exists
-
getToList
public java.util.List<SegTokenPair> getToList(int to)
Return aList
of all token pairs at this offset (index of the second token)- Parameters:
to
- index of the second token in the token pair- Returns:
List
of token pairs.
-
addSegTokenPair
public void addSegTokenPair(SegTokenPair tokenPair)
Add aSegTokenPair
- Parameters:
tokenPair
-SegTokenPair
-
getToCount
public int getToCount()
Get the number ofSegTokenPair
entries in the table.- Returns:
- number of
SegTokenPair
entries
-
getShortPath
public java.util.List<SegToken> getShortPath()
Find the shortest path with the Viterbi algorithm.- Returns:
List
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
-