Class CFSA2Serializer
java.lang.Object
morfologik.fsa.builders.CFSA2Serializer
- All Implemented Interfaces:
FSASerializer
Serializes in-memory
FSA graphs to CFSA2.
It is possible to serialize the automaton with numbers required for perfect
hashing. See withNumbers() method.
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiongetFlags()Return supported flags.<T extends OutputStream>
TwithAnnotationSeparator(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.
-
Constructor Details
-
CFSA2Serializer
public CFSA2Serializer()
-
-
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.
-
serialize
- 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).
-
withFiller
Description copied from interface:FSASerializerSets the filler separator (only ifFSASerializer.getFlags()returnsFSAFlags.SEPARATORS).- Specified by:
withFillerin interfaceFSASerializer- Parameters:
filler- The filler separator byte.- Returns:
- Returns
thisfor call chaining.
-
withAnnotationSeparator
Description copied from interface:FSASerializerSets the annotation separator (only ifFSASerializer.getFlags()returnsFSAFlags.SEPARATORS).- Specified by:
withAnnotationSeparatorin interfaceFSASerializer- Parameters:
annotationSeparator- The filler separator byte.- Returns:
- Returns
thisfor call chaining.
-