|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectmorfologik.fsa.FSA
morfologik.fsa.FSA5
public final class FSA5
FSA binary format implementation for version 5.
Version 5 indicates the dictionary was built with these flags:
FSAFlags.FLEXIBLE
, FSAFlags.STOPBIT
and
FSAFlags.NEXTBIT
. The internal representation of the FSA must
therefore follow this description (please note this format describes only a
single transition (arc), not the entire dictionary file).
---- this node header present only if automaton was compiled with NUMBERS option. Byte +-+-+-+-+-+-+-+-+\ 0 | | | | | | | | | \ LSB +-+-+-+-+-+-+-+-+ + 1 | | | | | | | | | | number of strings recognized +-+-+-+-+-+-+-+-+ +----- by the automaton starting : : : : : : : : : | from this node. +-+-+-+-+-+-+-+-+ + ctl-1 | | | | | | | | | / MSB +-+-+-+-+-+-+-+-+/ ---- remaining part of the node Byte +-+-+-+-+-+-+-+-+\ 0 | | | | | | | | | +------ label +-+-+-+-+-+-+-+-+/ +------------- node pointed to is next | +----------- the last arc of the node | | +--------- the arc is final | | | +-----------+ | | | | | ___+___ | | | | / \ | | | | MSB LSB | 7 6 5 4 3 2 1 0 | +-+-+-+-+-+-+-+-+ | 1 | | | | | | | | | \ \ +-+-+-+-+-+-+-+-+ \ \ LSB +-+-+-+-+-+-+-+-+ + 2 | | | | | | | | | | +-+-+-+-+-+-+-+-+ | 3 | | | | | | | | | +----- target node address (in bytes) +-+-+-+-+-+-+-+-+ | (not present except for the byte : : : : : : : : : | with flags if the node pointed to +-+-+-+-+-+-+-+-+ + is next) gtl | | | | | | | | | / MSB +-+-+-+-+-+-+-+-+ / gtl+1 (gtl = gotoLength)
Field Summary | |
---|---|
static int |
ADDRESS_OFFSET
An offset in the arc structure, where the address and flags field begins. |
byte |
annotation
Annotation character. |
byte[] |
arcs
An array of bytes with the internal representation of the automaton. |
static int |
BIT_FINAL_ARC
Bit indicating that an arc corresponds to the last character of a sequence available when building the automaton. |
static int |
BIT_LAST_ARC
Bit indicating that an arc is the last one of the node's list and the following one belongs to another node. |
static int |
BIT_TARGET_NEXT
Bit indicating that the target node of this arc follows it in the compressed automaton structure (no goto field). |
static byte |
DEFAULT_ANNOTATION
Default annotation byte. |
static byte |
DEFAULT_FILLER
Default filler byte. |
byte |
filler
Filler character. |
int |
gtl
Number of bytes each address takes in full, expanded form (goto length). |
int |
nodeDataLength
The length of the node header structure (if the automaton was compiled with NUMBERS option). |
static byte |
VERSION
Automaton version as in the file header. |
Constructor Summary | |
---|---|
FSA5(java.io.InputStream fsaStream)
Read and wrap a binary automaton in FSA version 5. |
Method Summary | |
---|---|
int |
getArc(int node,
byte label)
|
byte |
getArcLabel(int arc)
Return the label associated with a given arc . |
int |
getEndNode(int arc)
Return the end node pointed to by a given arc . |
int |
getFirstArc(int node)
|
java.util.Set<FSAFlags> |
getFlags()
Returns a set of flags for this FSA instance. |
int |
getNextArc(int arc)
|
int |
getRightLanguageCount(int node)
Returns the number encoded at the given node. |
int |
getRootNode()
Returns the start node of this automaton. |
boolean |
isArcFinal(int arc)
Returns true if the destination node at the end of this
arc corresponds to an input sequence created when building
this automaton. |
boolean |
isArcLast(int arc)
Returns true if this arc has LAST bit set. |
boolean |
isArcTerminal(int arc)
Returns true if this arc does not have a
terminating node (@link FSA.getEndNode(int) will throw an
exception). |
boolean |
isNextSet(int arc)
|
Methods inherited from class morfologik.fsa.FSA |
---|
getArcCount, getSequences, getSequences, iterator, read, visitAllStates, visitInPostOrder, visitInPostOrder, visitInPreOrder, visitInPreOrder |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final byte DEFAULT_FILLER
public static final byte DEFAULT_ANNOTATION
public static final byte VERSION
public static final int BIT_FINAL_ARC
public static final int BIT_LAST_ARC
public static final int BIT_TARGET_NEXT
public static final int ADDRESS_OFFSET
public final byte[] arcs
public final int nodeDataLength
NUMBERS
option). Otherwise zero.
public final int gtl
public final byte filler
public final byte annotation
Constructor Detail |
---|
public FSA5(java.io.InputStream fsaStream) throws java.io.IOException
java.io.IOException
Method Detail |
---|
public int getRootNode()
getRootNode
in class FSA
public final int getFirstArc(int node)
getFirstArc
in class FSA
node
or 0 if the node has no outgoing arcs.public final int getNextArc(int arc)
getNextArc
in class FSA
arc
and
leaving node
. Zero is returned if no more arcs are
available for the node.public int getArc(int node, byte label)
getArc
in class FSA
node
and
labeled with label
. An identifier equal to 0 means
the node has no outgoing arc labeled label
.public int getEndNode(int arc)
arc
. Terminal arcs
(those that point to a terminal state) have no end node representation
and throw a runtime exception.
getEndNode
in class FSA
public byte getArcLabel(int arc)
arc
.
getArcLabel
in class FSA
public boolean isArcFinal(int arc)
true
if the destination node at the end of this
arc
corresponds to an input sequence created when building
this automaton.
isArcFinal
in class FSA
public boolean isArcTerminal(int arc)
true
if this arc
does not have a
terminating node (@link FSA.getEndNode(int)
will throw an
exception). Implies FSA.isArcFinal(int)
.
isArcTerminal
in class FSA
public int getRightLanguageCount(int node)
node
(called its right
language).
getRightLanguageCount
in class FSA
FSAFlags.NUMBERS
. The size of
the right language of the state, in other words.public java.util.Set<FSAFlags> getFlags()
For this automaton version, an additional FSAFlags.NUMBERS
flag
may be set to indicate the automaton contains extra fields for each node.
getFlags
in class FSA
public boolean isArcLast(int arc)
true
if this arc has LAST
bit set.
BIT_LAST_ARC
public boolean isNextSet(int arc)
BIT_TARGET_NEXT
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |