File size: 452 Bytes
fc169ec
 
1d1fe97
a57cda3
 
1d1fe97
a57cda3
 
 
 
fc169ec
 
 
 
 
 
 
 
 
 
 
 
a57cda3
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')