Skip to content

Commit 8c46648

Browse files
committed
Partial fix for '(QP up to ...)' as reported in #1363
1 parent 5c57fde commit 8c46648

File tree

3 files changed

+12
-2
lines changed

3 files changed

+12
-2
lines changed

src/edu/stanford/nlp/trees/CoordinationTransformer.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -686,7 +686,7 @@ private static Tree findCCparent(Tree t, Tree root) {
686686
TregexPattern.compile("@WHADVP < ((WRB=node1 < /^(?i:how)$/) $+ (VB=node2 < /^(?i)come$/))"), //how come
687687
TregexPattern.compile("@VP < ((VBD=node1 < had|'d) $+ (@PRT|ADVP=node2 <: (RBR < /^(?i)better$/)))"), //had better
688688
TregexPattern.compile("@QP|XS < ((JJR|RBR|IN=node1 < /^(?i)(more|less)$/) $+ (IN=node2 < /^(?i)than$/))"), //more/less than
689-
TregexPattern.compile("@QP < ((JJR|RBR|IN=node1 < /^(?i)up$/) $+ (IN|TO=node2 < /^(?i)to$/))"), //up to
689+
TregexPattern.compile("@QP < ((JJR|RBR|RP|IN=node1 < /^(?i)up$/) $+ (IN|TO=node2 < /^(?i)to$/))"), //up to
690690
TregexPattern.compile("@S|SQ|VP|ADVP|PP < (@ADVP < ((IN|RB=node1 < /^(?i)at$/) $+ (JJS|RBS=node2 < /^(?i)least$/)) !$+ (RB < /(?i)(once|twice)/))"), //at least
691691

692692
};

src/edu/stanford/nlp/trees/EnglishGrammaticalRelations.java

+9-1
Original file line numberDiff line numberDiff line change
@@ -980,7 +980,15 @@ private EnglishGrammaticalRelations() {}
980980
public static final GrammaticalRelation QUANTIFIER_MODIFIER =
981981
new GrammaticalRelation(Language.English, "quantmod", "quantifier modifier",
982982
MODIFIER, "QP", tregexCompiler,
983-
"QP < IN|RB|RBR|RBS|PDT|DT|JJ|JJR|JJS|XS=target");
983+
// RP is because sometimes "up" in "up to ___" gets tagged RP in PTB
984+
// this is probably a mistake - generally it is tagged IN
985+
// but sometimes the tagger follows suit
986+
// there are no conflicts elsewhere in the targets of a QP,
987+
// so there should be no need to specifically check for the phrase "up to" for `up_RP`
988+
"QP < IN|RB|RBR|RBS|PDT|DT|JJ|JJR|JJS|XS|RP=target",
989+
// TO is for the "to" in "up to ___"
990+
// TODO: but currently not working for up_IN to_IN foo_CD, since it wants to make TO the head of IN!
991+
"(QP < (TO=target < /^(?i:to)$/) < (__=up < /^(?i:up)$/)) : (=up $++ =target)");
984992

985993

986994
/**

src/edu/stanford/nlp/trees/UniversalEnglishGrammaticalRelations.java

+2
Original file line numberDiff line numberDiff line change
@@ -1066,6 +1066,8 @@ private UniversalEnglishGrammaticalRelations() {}
10661066
"/^(?:VP|ADJP|JJP|WHADJP|SQ?|SBARQ?|SINV|XS|RRC|(?:WH)?NP(?:-TMP|-ADV)?)$/ < (RB|RBR|RBS|WRB|ADVP|WHADVP=target !< " + ETC_PAT + " [!<+(/ADVP/) (@ADVP < (IN < /(?i:at)/)) | !<+(/ADVP/) (@ADVP < NP)] )",
10671067
"QP < IN|RB|RBR|RBS|PDT|DT|JJ|JJR|JJS|XS=target", //quantmod relation in original SD
10681068
"QP < (MWE=target < (JJR|RBR|IN < /^(?i)(more|less)$/) < (IN < /^(?i)than$/))", //more than / less than
1069+
// TODO: could condense with the previous rule to save a little time
1070+
"QP < (MWE=target < (__ < /^(?i)up$/) < (__ < /^(?i)to$/))", // up to
10691071
// avoids adverb conjunctions matching as advmod; added JJ to catch How long
10701072
// "!< no" so we can get neg instead for "no foo" when no is tagged as RB
10711073
// we allow CC|CONJP as long as it is not between the target and the head

0 commit comments

Comments
 (0)