edu.stanford.nlp.parser.lexparser
Class ParserConstraint

java.lang.Object
  extended by edu.stanford.nlp.parser.lexparser.ParserConstraint
All Implemented Interfaces:
Serializable

public class ParserConstraint
extends Object
implements 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

Field Summary
 int end
           
 int start
           
 Pattern state
           
 
Constructor Summary
ParserConstraint()
           
ParserConstraint(int start, int end, Pattern state)
           
ParserConstraint(int start, int end, String pattern)
           
 
Method Summary
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

start

public int start

end

public int end

state

public Pattern state
Constructor Detail

ParserConstraint

public ParserConstraint()

ParserConstraint

public ParserConstraint(int start,
                        int end,
                        String pattern)

ParserConstraint

public ParserConstraint(int start,
                        int end,
                        Pattern state)


Stanford NLP Group