abhi1294 commited on
Commit
9c5b315
·
1 Parent(s): 900ed7a

Fix prompts and utils

Browse files
Files changed (2) hide show
  1. audio_tool.py +13 -3
  2. deterministic_solvers.py +1 -1
audio_tool.py CHANGED
@@ -44,8 +44,18 @@ import re
44
 
45
 
46
  def extract_page_numbers(text: str) -> str:
47
- nums = re.findall(r"\b\d+\b", text)
48
 
49
- pages = sorted(set(int(n) for n in nums))
50
 
51
- return ",".join(str(p) for p in pages)
 
 
 
 
 
 
 
 
 
 
 
44
 
45
 
46
  def extract_page_numbers(text: str) -> str:
47
+ text = text.lower()
48
 
49
+ matches = []
50
 
51
+ # page 245 / page 197
52
+ matches.extend(re.findall(r"\bpage\s+(\d+)\b", text))
53
+
54
+ # pages 132, 133 and 134
55
+ plural_blocks = re.findall(r"\bpages\s+([0-9,\sand]+)", text)
56
+ for block in plural_blocks:
57
+ matches.extend(re.findall(r"\d+", block))
58
+
59
+ nums = sorted(set(int(x) for x in matches))
60
+ return ",".join(str(n) for n in nums)
61
+
deterministic_solvers.py CHANGED
@@ -20,7 +20,7 @@ def solve_reverse_text(question: str) -> str:
20
 
21
  if 'opposite of the word "left"' in reversed_question or "opposite" in reversed_question:
22
  if "left" in reversed_question:
23
- return "right"
24
 
25
  return ""
26
 
 
20
 
21
  if 'opposite of the word "left"' in reversed_question or "opposite" in reversed_question:
22
  if "left" in reversed_question:
23
+ return "Right"
24
 
25
  return ""
26