src/python/txtai/pipeline.py
def regex(self, tokens):
        """
        Builds a regular expression from tokens.

        Args:
            tokens: input tokens

        Returns:
            regex to use to extract match in original text
        """

        regex = []

        for token in tokens:
            # Escape regex characters
            token = re.escape(token)

            # Handle subwords
            if token.startswith("\\#\\#"):
                token = re.sub(r"^\\#\\#", "", token)

            regex.append(token)

        # Build and return complete regular expression
        return "\\s?".join(regex)

        Builds a regular expression from tokens.

        Args:
            tokens: input tokens

        Returns:
            regex to use to extract match in original text
        
Builds a regular expression from tokens.
Builds a regular expression from tokens .
def regex(self, tokens):
        regex = []
        for token in tokens:
            token = re.escape(token)
            if token.startswith("\\#\\#"):
                token = re.sub(r"^\\#\\#", "", token)
            regex.append(token)
        return "\\s?".join(regex)
def regex ( self , tokens ) : regex = [ ] for token in tokens : token = re . escape ( token ) if token . startswith ( "\\#\\#" ) : token = re . sub ( r"^\\#\\#" , "" , token ) regex . append ( token ) return "\\s?" . join ( regex )
Builds a regular expression from tokens.
Builds a regular expression from tokens .
"""
        Builds a regular expression from tokens.

        Args:
            tokens: input tokens

        Returns:
            regex to use to extract match in original text
        """ # Escape regex characters # Handle subwords # Build and return complete regular expression
regex to use to extract match in original text
regex to use to extract match in original text
self
tokens
None