public class PcfgIrtgInputCodec extends InputCodec<InterpretedTreeAutomaton>
A -> B c D [0.3]Rule probabilities may optionally be specified in square brackets for each rule. Rules without explicit probabilities receive weight 1; this can be used to specify an ordinary, non-probabilistic context-free grammar.
The codec infers which symbols are nonterminals by taking all symbols that occur on the left-hand side of a rule as nonterminals. This means that the terminal and nonterminal symbols must be disjoint sets, otherwise the grammar will not be equivalent to what you intended.
The codec represents the context-free grammar as an IRTG with a single
interpretation called "string" over a StringAlgebra
.
This algebra has only a single concatenation operator, "*"; it has arity 2.
You may still use multiple symbols on the right-hand side of your CFG rules.
These will be combined together using binary concatenations in an unspecified
bracketing.
Constructor and Description |
---|
PcfgIrtgInputCodec() |
Modifier and Type | Method and Description |
---|---|
static void |
main(String[] args) |
InterpretedTreeAutomaton |
read(InputStream is)
Reads an object from an input stream.
|
addOptions, getAllInputCodecs, getInputCodecByExtension, getInputCodecByName, getInputCodecByNameOrExtension, getInputCodecs, getMetadata, getOption, hasTrueOption, read, setOption, setProgressListener
public InterpretedTreeAutomaton read(InputStream is) throws CodecParseException, IOException
InputCodec
read
in class InputCodec<InterpretedTreeAutomaton>
CodecParseException
- if an error occurred while decoding
the input stream into an objectIOException
- if an error occurred while reading
data from the input streamCopyright © 2017. All rights reserved.