- All Implemented Interfaces:
- java.io.Serializable
public class ParserConstraint
extends java.lang.Object
implements java.io.Serializable
A Constraint represents a restriction on possible parse trees to
consider. It says that a parse cannot be postulated that would
contradict having a constituent from position start to end, and
that any constituent postulated with this span must match the
regular expression given by state. Note, however, that it does not
strictly guarantee that such a constituent exists in a returned
parse.
The words in constraint bounds are counted starting from 0.
Furthermore, the end number is not included in the constraint.
For example, a constraint covering the first two words of a
sentence has a start of 0 and an end of 2.
state must successfully match states used internal to the parser,
not just the final states, so the pattern "NP" will not match
anything. Better is "NP.*". Note that this does run the risk of
matching states with the same prefix. For example, there is SBAR
and SBARQ, so "SBAR.*" could have unexpected results. The states
used internal to the parser extend the state name with
non-alphanumeric characters, so a fancy expression such as
"SBAR|SBAR[^a-zA-Z].*" would match SBAR but not SBARQ constituents.
- See Also:
- Serialized Form