Firstly, Im not sure what Im looking for is tregex but im going to try my best to explain my question.
What I want to do is, lets say I've a custom grammar like below.
VP -> V + NP + PP
NP -> NN | PRP
PP -> IN + NP
V is all verbs meaning it doesn't matter if its past or present etc.
+ means concat
| means or
And I've a string of postags like below.
VBZ PRP IN NN
What I want to do is to check if this string is valid for the grammar above. I want to do that using the Stanford NLP API since my project uses it. I know I can use a compiler like jacc but I want to stick with Stanford NLP.
Thanks.
I'm afraid that Tregex doesn't do what you want. It's a pattern matcher over tree structures. It isn't a parser. In theory the Stanford Parser can do parsing with any grammar, but in practice, there is no support for hand-written grammars. So you would be best off using a tool like jacc, JavaCC or ANTLR.