Update retriever.py
Browse files- retriever.py +0 -13
retriever.py
CHANGED
|
@@ -164,19 +164,6 @@ class EnAgent:
|
|
| 164 |
|
| 165 |
return answer
|
| 166 |
|
| 167 |
-
def find_country_with_min_athletes(self, text: str) -> Optional[str]:
|
| 168 |
-
matches = re.findall(r"\b([A-Z][a-z]+(?: [A-Z][a-z]+)?)\s*\((\d+)\)", text)
|
| 169 |
-
if not matches:
|
| 170 |
-
return None
|
| 171 |
-
min_count = min(int(c) for _, c in matches)
|
| 172 |
-
filtered = [country for country, count in matches if int(count) == min_count]
|
| 173 |
-
return sorted(filtered)[0] if filtered else None
|
| 174 |
-
|
| 175 |
-
def extract_ioc_code(self, country_name: str, ioc_text: str) -> Optional[str]:
|
| 176 |
-
pattern = re.compile(rf"{re.escape(country_name)}\s*\((\w{{3}})\)", re.IGNORECASE)
|
| 177 |
-
match = pattern.search(ioc_text)
|
| 178 |
-
return match.group(1).upper() if match else None
|
| 179 |
-
|
| 180 |
def preprocess_question(self, question: str) -> str:
|
| 181 |
question = question.strip().lower()
|
| 182 |
question = re.sub(r"[^\w\s]", "", question)
|
|
|
|
| 164 |
|
| 165 |
return answer
|
| 166 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 167 |
def preprocess_question(self, question: str) -> str:
|
| 168 |
question = question.strip().lower()
|
| 169 |
question = re.sub(r"[^\w\s]", "", question)
|