Class FSA5Serializer
java.lang.Object
morfologik.fsa.builders.FSA5Serializer
- All Implemented Interfaces:
FSASerializer
Serializes in-memory
FSA graphs to a binary format compatible with
Jan Daciuk's fsa's package FSA5 format.
It is possible to serialize the automaton with numbers required for perfect
hashing. See withNumbers() method.
- See Also:
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiongetFlags()Return supported flags.<T extends OutputStream>
TSerialize root statesto an output stream inFSA5format.withAnnotationSeparator(byte annotationSeparator) Sets the annotation separator (only ifFSASerializer.getFlags()returnsFSAFlags.SEPARATORS).withFiller(byte filler) Sets the filler separator (only ifFSASerializer.getFlags()returnsFSAFlags.SEPARATORS).Serialize the automaton with the number of right-language sequences in each node.
-
Field Details
-
fillerByte
public byte fillerByte- See Also:
-
annotationByte
public byte annotationByte- See Also:
-
-
Constructor Details
-
FSA5Serializer
public FSA5Serializer()
-
-
Method Details
-
withNumbers
Serialize the automaton with the number of right-language sequences in each node. This is required to implement perfect hashing. The numbering also preserves the order of input sequences.- Specified by:
withNumbersin interfaceFSASerializer- Returns:
- Returns the same object for easier call chaining.
-
withFiller
Sets the filler separator (only ifFSASerializer.getFlags()returnsFSAFlags.SEPARATORS).- Specified by:
withFillerin interfaceFSASerializer- Parameters:
filler- The filler separator byte.- Returns:
- Returns
thisfor call chaining.
-
withAnnotationSeparator
Sets the annotation separator (only ifFSASerializer.getFlags()returnsFSAFlags.SEPARATORS).- Specified by:
withAnnotationSeparatorin interfaceFSASerializer- Parameters:
annotationSeparator- The filler separator byte.- Returns:
- Returns
thisfor call chaining.
-
serialize
Serialize root statesto an output stream inFSA5format.- Specified by:
serializein interfaceFSASerializer- Type Parameters:
T- A subclass ofOutputStream, returned for chaining.- Parameters:
fsa- The automaton to serialize.os- The output stream to serialize to.- Returns:
- Returns
osfor chaining. - Throws:
IOException- Rethrown if an I/O error occurs.- See Also:
-
getFlags
Return supported flags.- Specified by:
getFlagsin interfaceFSASerializer- Returns:
- Returns the set of flags supported by the serializer (and the output automaton).
-