Upload processors.py with huggingface_hub
Browse files- processors.py +9 -0
processors.py
CHANGED
@@ -215,3 +215,12 @@ class StringOrNotString(FieldOperator):
|
|
215 |
if self.string.lower() in text.lower():
|
216 |
return self.string.lower()
|
217 |
return text
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
215 |
if self.string.lower() in text.lower():
|
216 |
return self.string.lower()
|
217 |
return text
|
218 |
+
|
219 |
+
|
220 |
+
class ExtractMtBenchJudgment(FieldOperator):
|
221 |
+
def process_value(self, text: Any) -> Any:
|
222 |
+
match = re.search(r"\[\[([\d]+\.?[\d]*)\]\]", text)
|
223 |
+
try:
|
224 |
+
return float(match.group(1)) / 10
|
225 |
+
except:
|
226 |
+
return 0.0
|