public abstract class AbstractContextGenerator extends Object
Modifier and Type | Field and Description |
---|---|
protected static String |
EOS |
protected Set<String> |
punctSet
Set of punctuation to be used in generating features.
|
protected boolean |
useLabel |
protected boolean |
zeroBackOff |
Constructor and Description |
---|
AbstractContextGenerator() |
Modifier and Type | Method and Description |
---|---|
protected void |
checkcons(Parse p1,
Parse p2,
String type,
List<String> features) |
protected void |
checkcons(Parse child,
String i,
String type,
List<String> features)
Produces features to determine whether the specified child node is part of
a complete constituent of the specified type and adds those features to the
specfied list.
|
protected String |
cons(Parse p,
int i) |
protected void |
cons2(List<String> features,
Cons c0,
Cons c1,
Collection<Parse> punct1s,
boolean bigram) |
protected void |
cons3(List<String> features,
Cons c0,
Cons c1,
Cons c2,
Collection<Parse> punct1s,
Collection<Parse> punct2s,
boolean trigram,
boolean bigram1,
boolean bigram2)
Creates cons features involving the 3 specified nodes and adds them to the specified feature list.
|
protected String |
consbo(Parse p,
int i) |
protected void |
getFrontierNodes(List<Parse> rf,
Parse[] nodes)
Populates specified nodes array with left-most right frontier
node with a unique head.
|
protected String |
production(Parse p,
boolean includePunctuation)
Generates a string representing the grammar rule production that the specified parse
is starting.
|
protected String |
punct(Parse punct,
int i)
Creates punctuation feature for the specified punctuation at the specified index based on the punctuation mark.
|
protected String |
punctbo(Parse punct,
int i)
Creates punctuation feature for the specified punctuation at the specfied index based on the punctuation's tag.
|
protected void |
surround(Parse node,
int i,
String type,
Collection<Parse> punctuation,
List<String> features)
Generates features for nodes surrounding a completed node of the specified type.
|
protected static final String EOS
protected boolean zeroBackOff
protected boolean useLabel
protected String punct(Parse punct, int i)
punct
- The punctuation which is in context.i
- The index of the punctuation with relative to the parse.protected String punctbo(Parse punct, int i)
punct
- The punctuation which is in context.i
- The index of the punctuation relative to the parse.protected String production(Parse p, boolean includePunctuation)
p
- The parse which stats teh production.includePunctuation
- Whether punctuation should be included in the production.protected void cons2(List<String> features, Cons c0, Cons c1, Collection<Parse> punct1s, boolean bigram)
protected void cons3(List<String> features, Cons c0, Cons c1, Cons c2, Collection<Parse> punct1s, Collection<Parse> punct2s, boolean trigram, boolean bigram1, boolean bigram2)
features
- The list of features.c0
- The first node.c1
- The second node.c2
- The third node.punct1s
- The punctuation between the first and second node.punct2s
- The punctuation between the second and third node.trigram
- Specifies whether lexical tri-gram features between these nodes should be generated.bigram1
- Specifies whether lexical bi-gram features between the first and second node should be generated.bigram2
- Specifies whether lexical bi-gram features between the second and third node should be generated.protected void surround(Parse node, int i, String type, Collection<Parse> punctuation, List<String> features)
node
- A surrounding node.i
- The index of the surrounding node with respect to the completed node.type
- The type of the completed node.punctuation
- The punctuation adjacent and between the specified surrounding node.features
- A list to which features are added.protected void checkcons(Parse child, String i, String type, List<String> features)
child
- The parse node to consider.i
- A string indicating the position of the child node.type
- The type of constituent being built.features
- List to add features to.protected void getFrontierNodes(List<Parse> rf, Parse[] nodes)
rf
- The current right frontier.nodes
- The array to be populated.Copyright © 2016 The Apache Software Foundation. All rights reserved.