File size: 452 Bytes
2746bef
 
f2336e3
2636a15
 
f2336e3
2636a15
 
 
 
2746bef
 
 
 
 
 
 
 
 
 
 
 
2636a15
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
import re

from .operator import BaseFieldOperator


class ToString(BaseFieldOperator):
    def process(self, instance):
        return str(instance)


class RegexParser(BaseFieldOperator):
    """
    A processor that uses regex in order to parse a string.
    """

    regex: str

    def process(self, text):
        matches = re.findall(self.regex, text)
        return matches


# add_to_catalog(ToString('prediction'), 'processors', 'to_string')