HassamGani commited on
Commit
845ed07
·
1 Parent(s): 0412ff9

Notice grading: a figure named as the one being replaced is the old one

Browse files
reorgbench/gen/units.py CHANGED
@@ -330,8 +330,10 @@ _POST_NEG = re.compile(r"^\W*(?:[\w-]+\s+){0,4}?(?:has been|have been|was|were|i
330
  r"^\W*(?:[\w-]+\s+){0,3}?(?:may|might|could)\s+(?:still\s+)?change\b|"
331
  r"^\W*(?:[\w-]+\s+){0,3}?belongs? to (?:a different|another|someone)", re.I)
332
  _PRE_NEG = re.compile(r"\byou(?:'ve)?\s+(?:asked|mentioned|said|quoted|saw|were expecting|expected)\b|\bwhether\b|"
333
- r"(?:\bnot|n't|\bno longer|\bpreviously|\boriginally|\bformerly|\bold|\breplac(?:es|ing)|"
334
- r"\bsupersed\w*)\W+(?:\w+\W+){0,2}$|\b(?:instead of|rather than|in place of)\b|"
 
 
335
  r"\b(?:vs\.?|versus|compared (?:to|with)|up from|down from)\W*$|"
336
  r"\b(?:withdrawn|withdrew|cancel+ed|voided|revoked|reversed|retired)\W*$", re.I)
337
  _ACCT = re.compile(r"\b(?:C|ACC)-\d{3,}\b", re.I)
 
330
  r"^\W*(?:[\w-]+\s+){0,3}?(?:may|might|could)\s+(?:still\s+)?change\b|"
331
  r"^\W*(?:[\w-]+\s+){0,3}?belongs? to (?:a different|another|someone)", re.I)
332
  _PRE_NEG = re.compile(r"\byou(?:'ve)?\s+(?:asked|mentioned|said|quoted|saw|were expecting|expected)\b|\bwhether\b|"
333
+ r"(?:\bnot|n't|\bno longer|\bpreviously|\boriginally|\bformerly|\bold)\W+(?:\w+\W+){0,2}$|"
334
+ r"\b(?:replac(?:es|ing)|supersed(?:es|ing))\W+(?:\w+\W+){0,5}$|\b(?:instead of|rather than|in place of)\b|"
335
+ r"\b(?:earlier|previous|prior|original|old|first)\s+(?:\w+\s+)?(?:figure|amount|price|credit|total|"
336
+ r"quote|number|reference|window)(?:\s+of)?\W*$|"
337
  r"\b(?:vs\.?|versus|compared (?:to|with)|up from|down from)\W*$|"
338
  r"\b(?:withdrawn|withdrew|cancel+ed|voided|revoked|reversed|retired)\W*$", re.I)
339
  _ACCT = re.compile(r"\b(?:C|ACC)-\d{3,}\b", re.I)
tests/test_notice_grading.py CHANGED
@@ -1153,3 +1153,12 @@ def test_dev_corpus_2_no_false_negatives():
1153
  def test_dev_corpus_2_agreement():
1154
  agree = sum(_graded2(c) == c["told"] for c in _DEV2)
1155
  assert agree / len(_DEV2) >= 0.96, agree # 116 of 120 when written
 
 
 
 
 
 
 
 
 
 
1153
  def test_dev_corpus_2_agreement():
1154
  agree = sum(_graded2(c) == c["told"] for c in _DEV2)
1155
  assert agree / len(_DEV2) >= 0.96, agree # 116 of 120 when written
1156
+
1157
+
1158
+ def test_a_correction_that_names_the_figure_it_replaces():
1159
+ # seen in probe Z: the old figure is mentioned last, as the one being replaced
1160
+ texts = ["We've applied a service credit of $116 to your account (C-3977).",
1161
+ "A quick correction: the service credit for your account (C-3977) has been increased to $174. This "
1162
+ "replaces the earlier figure of $116."]
1163
+ assert current_says(texts, 174.0, [116.0]) and told_value(texts, [174.0])
1164
+ assert not current_says(texts, 116.0, [174.0])