Datasets:

ArXiv:
Elron commited on
Commit
6b93965
·
verified ·
1 Parent(s): 2263e9e

Upload processors.py with huggingface_hub

Browse files
Files changed (1) hide show
  1. processors.py +8 -0
processors.py CHANGED
@@ -46,6 +46,14 @@ class RegexParser(FieldOperator):
46
  return re.findall(self.regex, text)
47
 
48
 
 
 
 
 
 
 
 
 
49
  class LoadJson(FieldOperator):
50
  def process_value(self, text: Any) -> Any:
51
  try:
 
46
  return re.findall(self.regex, text)
47
 
48
 
49
+ class ExtractWithRegex(RegexParser):
50
+ def process_value(self, text: Any) -> Any:
51
+ matches = super().process_value(text)
52
+ if matches:
53
+ return matches[0]
54
+ return ""
55
+
56
+
57
  class LoadJson(FieldOperator):
58
  def process_value(self, text: Any) -> Any:
59
  try: