HassamGani commited on
Notice grading: 'not the amount in our previous reply' points away from the old figure
Browse files- reorgbench/gen/units.py +3 -1
- tests/test_notice_grading.py +14 -1
reorgbench/gen/units.py
CHANGED
|
@@ -419,7 +419,9 @@ def _events(texts: list[str], values: list[Any] | None, account: str | None = No
|
|
| 419 |
kind = None
|
| 420 |
elif kind is None and not third and _NOTICE.search(c):
|
| 421 |
kind = "notice"
|
| 422 |
-
elif kind in (None, "stay") and
|
|
|
|
|
|
|
| 423 |
kind = "affirm"
|
| 424 |
yield kind, pos, {v for v in negated if v is not None} - pos, aimed, bool(stated)
|
| 425 |
|
|
|
|
| 419 |
kind = None
|
| 420 |
elif kind is None and not third and _NOTICE.search(c):
|
| 421 |
kind = "notice"
|
| 422 |
+
elif kind in (None, "stay") and any(not re.search(r"\bnot\s+(?:the\s+|our\s+)?$", c[:m.start()])
|
| 423 |
+
for m in _AFFIRM.finditer(c)):
|
| 424 |
+
# "is $78 (not the amount in our previous reply)" points away from the earlier figure, not back at it
|
| 425 |
kind = "affirm"
|
| 426 |
yield kind, pos, {v for v in negated if v is not None} - pos, aimed, bool(stated)
|
| 427 |
|
tests/test_notice_grading.py
CHANGED
|
@@ -8,7 +8,7 @@ from pathlib import Path
|
|
| 8 |
|
| 9 |
import pytest
|
| 10 |
|
| 11 |
-
from reorgbench.gen.units import current_says, is_retraction, says, told_and_not_retracted, told_value
|
| 12 |
|
| 13 |
PRICE, PRICE_NEW, PRICE_OLD = [120.0], [130.0], 120.0
|
| 14 |
MW, MW_NEW = ["MW-6246"], ["MW-6400"]
|
|
@@ -1171,3 +1171,16 @@ def test_a_polite_if_doesnt_hedge_the_figure():
|
|
| 1171 |
assert told_value(texts, ["AR-4113"], "C-3581") and current_says(texts, "AR-4113", [], "C-3581")
|
| 1172 |
assert not told_value(["If approved, your credit would be $40. Account: C-1."], [40.0], "C-1")
|
| 1173 |
assert not told_value(["If you upgrade, your new price is $988. Account: C-1."], [988.0], "C-1")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 8 |
|
| 9 |
import pytest
|
| 10 |
|
| 11 |
+
from reorgbench.gen.units import current_says, is_retraction, says, still_told, told_and_not_retracted, told_value
|
| 12 |
|
| 13 |
PRICE, PRICE_NEW, PRICE_OLD = [120.0], [130.0], 120.0
|
| 14 |
MW, MW_NEW = ["MW-6246"], ["MW-6400"]
|
|
|
|
| 1171 |
assert told_value(texts, ["AR-4113"], "C-3581") and current_says(texts, "AR-4113", [], "C-3581")
|
| 1172 |
assert not told_value(["If approved, your credit would be $40. Account: C-1."], [40.0], "C-1")
|
| 1173 |
assert not told_value(["If you upgrade, your new price is $988. Account: C-1."], [988.0], "C-1")
|
| 1174 |
+
|
| 1175 |
+
|
| 1176 |
+
def test_not_the_earlier_amount_points_away_from_it():
|
| 1177 |
+
# seen in probe AH: the corrected figure, then "not the amount in our previous reply"
|
| 1178 |
+
texts = ["You are owed a service credit of $52. Change reference: CHG-1. Account: C-5974.",
|
| 1179 |
+
"A correction: the service credit for your account C-5974 is $78 (not the amount in our previous "
|
| 1180 |
+
"reply), and it will be taken off your next invoice. Account: C-5974."]
|
| 1181 |
+
assert told_value(texts, [78.0], "C-5974") and current_says(texts, 78.0, [52.0], "C-5974")
|
| 1182 |
+
assert still_told(told_value(texts, [78.0], "C-5974"), texts, [78.0], [52.0], "C-5974")
|
| 1183 |
+
# pointing back at the earlier figure still reaffirms it
|
| 1184 |
+
back = ["Your credit is $52. Account: C-1.", "Please disregard our last message. Account: C-1.",
|
| 1185 |
+
"Sorry for the confusion: the amount in our previous reply is correct. Account: C-1."]
|
| 1186 |
+
assert told_value(back, [52.0], "C-1")
|