j-js commited on
Commit
9e26223
·
verified ·
1 Parent(s): 4afc5be

Update explainers/explainer_percent.py

Browse files
Files changed (1) hide show
  1. explainers/explainer_percent.py +12 -29
explainers/explainer_percent.py CHANGED
@@ -1,5 +1,3 @@
1
- # explainer_percent.py
2
-
3
  import re
4
  from models import ExplainerResult
5
 
@@ -22,7 +20,7 @@ def explain_percent_question(text: str) -> ExplainerResult | None:
22
  if percent_matches:
23
  givens.append(f"A percentage is given: {', '.join(percent_matches[:3])}")
24
  else:
25
- givens.append("A percent relationship is given")
26
 
27
  if "of" in t:
28
  givens.append("The wording uses an 'of' relationship")
@@ -32,38 +30,23 @@ def explain_percent_question(text: str) -> ExplainerResult | None:
32
 
33
  relationships.append("This is a part-percent-whole relationship")
34
 
35
- if "of" in t:
36
- relationships.append("One quantity is being described as a percent of another quantity")
37
-
38
  if "increase" in t:
39
- relationships.append("The question may involve a percent increase from an original value")
40
 
41
  if "decrease" in t:
42
- relationships.append("The question may involve a percent decrease from an original value")
43
 
44
- if "original" in t or "whole" in t or "base" in t:
45
- constraints.append("Pay attention to which value is the original whole or base")
46
 
47
- if "more than" in t or "less than" in t:
48
- constraints.append("Watch the comparison wording carefully")
49
-
50
- asks_for = None
51
- if "original" in t or "whole" in t:
52
- asks_for = "the original whole value"
53
- elif "what percent" in t or "what percentage" in t:
54
- asks_for = "the missing percent"
55
- elif "what is" in t or "find" in t or "how much" in t:
56
- asks_for = "the missing value in the percent relationship"
57
 
58
  trap_notes.extend([
59
  "Do not confuse the part with the whole",
60
- "Check whether you are solving for the percent, the part, or the whole",
61
- "Make sure the percent is attached to the correct base value",
62
  ])
63
 
64
- if "increase" in t or "decrease" in t:
65
- trap_notes.append("Do not mix up the original amount and the changed amount")
66
-
67
  return ExplainerResult(
68
  understood=True,
69
  topic="percent",
@@ -73,10 +56,10 @@ def explain_percent_question(text: str) -> ExplainerResult | None:
73
  relationships=relationships,
74
  needed_concepts=[
75
  "percent equation",
76
- "part-whole thinking",
77
- "identifying the base value",
78
  ],
79
  trap_notes=trap_notes,
80
- strategy_hint="First decide which number is the whole, which is the part, and whether the question is asking you to work forward or backward.",
81
- plain_english="The question is describing a percent relationship and asking you to identify the missing value in that setup.",
82
  )
 
 
 
1
  import re
2
  from models import ExplainerResult
3
 
 
20
  if percent_matches:
21
  givens.append(f"A percentage is given: {', '.join(percent_matches[:3])}")
22
  else:
23
+ givens.append("A percent relationship is described")
24
 
25
  if "of" in t:
26
  givens.append("The wording uses an 'of' relationship")
 
30
 
31
  relationships.append("This is a part-percent-whole relationship")
32
 
 
 
 
33
  if "increase" in t:
34
+ relationships.append("This may involve a percent increase from an original value")
35
 
36
  if "decrease" in t:
37
+ relationships.append("This may involve a percent decrease from an original value")
38
 
39
+ if "original" in t or "base" in t:
40
+ constraints.append("Identify the original/base value carefully")
41
 
42
+ asks_for = "the missing value in the percent relationship"
 
 
 
 
 
 
 
 
 
43
 
44
  trap_notes.extend([
45
  "Do not confuse the part with the whole",
46
+ "Check whether you are solving for percent, part, or whole",
47
+ "Make sure the percent is applied to the correct base value",
48
  ])
49
 
 
 
 
50
  return ExplainerResult(
51
  understood=True,
52
  topic="percent",
 
56
  relationships=relationships,
57
  needed_concepts=[
58
  "percent equation",
59
+ "part = percent × whole",
60
+ "base value identification",
61
  ],
62
  trap_notes=trap_notes,
63
+ strategy_hint="Translate the sentence into a percent equation before calculating anything.",
64
+ plain_english="The question is describing a percent relationship and asking you to identify a missing value within that structure.",
65
  )