Skip to content

Commit

Permalink
Separate off the NML part of the nn relationship so that we can do it…
Browse files Browse the repository at this point in the history
… without the comma restriction. This especially finds lists of NML as nn modifiers of a noun
  • Loading branch information
AngledLuffa committed Aug 2, 2023
1 parent 133ddd8 commit 61ef545
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/edu/stanford/nlp/trees/EnglishGrammaticalRelations.java
Original file line number Diff line number Diff line change
Expand Up @@ -1018,7 +1018,10 @@ private EnglishGrammaticalRelations() {}
public static final GrammaticalRelation NOUN_COMPOUND_MODIFIER =
new GrammaticalRelation(Language.English, "nn", "nn modifier",
MODIFIER, "(?:WH)?(?:NP|NX|NAC|NML|ADVP|ADJP)(?:-TMP|-ADV)?", tregexCompiler,
"/^(?:WH)?(?:NP|NX|NAC|NML)(?:-TMP|-ADV)?$/ < (NP|NML|NN|NNS|NNP|NNPS|FW|AFX=target $++ NN|NNS|NNP|NNPS|FW|CD=sister !<<- POS !<<- (VBZ < /^[\'’]s$/) !$- /^,$/ !$++ (POS $++ =sister))",
"/^(?:WH)?(?:NP|NX|NAC|NML)(?:-TMP|-ADV)?$/ < (NP|NN|NNS|NNP|NNPS|FW|AFX=target $++ NN|NNS|NNP|NNPS|FW|CD=sister !<<- POS !<<- (VBZ < /^[\'’]s$/) !$- /^,$/ !$++ (POS $++ =sister))",
// same thing as the above, but without the comma. NML in such a situation is typically a noun phrase modifying a noun,
// whereas other nodes such as NN can be parts of lists or otherwise unsuitable for the nn relationship
"/^(?:WH)?(?:NP|NX|NAC|NML)(?:-TMP|-ADV)?$/ < (NML=target $++ NN|NNS|NNP|NNPS|FW|CD=sister !<<- POS !<<- (VBZ < /^[\'’]s$/) !$++ (POS $++ =sister))",
"/^(?:WH)?(?:NP|NX|NAC|NML)(?:-TMP|-ADV)?$/ < JJ|JJR|JJS=sister < (NP|NML|NN|NNS|NNP|NNPS|FW=target !<<- POS !<<- (VBZ < /^[\'’]s$/) $+ =sister) <# NN|NNS|NNP|NNPS !<<- POS !<<- (VBZ < /^[\'’]s$/) ",
// in vitro, in vivo, etc., in Genia
// matches against "etc etc"
Expand Down

0 comments on commit 61ef545

Please sign in to comment.