(self, text, matches, startchar=0, endchar= -1)
:param text: the source text of the fragment.
        :param matches: a list of objects which have ``startchar`` and
            ``endchar`` attributes, and optionally a ``text`` attribute.
        :param startchar: the index into ``text`` at which the fragment starts.
            The default is 0.
        :param endchar: the index into ``text`` at which the fragment ends.
            The default is -1, which is interpreted as the length of ``text``.
:param text: the source text of the fragment.
        :param matches: a list of objects which have ``startchar`` and
            ``endchar`` attributes, and optionally a ``text`` attribute.
        :param startchar: the index into ``text`` at which the fragment starts.
            The default is 0.
        :param endchar: the index into ``text`` at which the fragment ends.
            The default is -1, which is interpreted as the length of ``text``.
: param text : the source text of the fragment . : param matches : a list of objects which have startchar and endchar attributes and optionally a text attribute . : param startchar : the index into text at which the fragment starts . The default is 0 . : param endchar : the index into text at which the fragment ends . The default is - 1 which is interpreted as the length of text .
def __init__(self, text, matches, startchar=0, endchar= -1):
        """
        :param text: the source text of the fragment.
        :param matches: a list of objects which have ``startchar`` and
            ``endchar`` attributes, and optionally a ``text`` attribute.
        :param startchar: the index into ``text`` at which the fragment starts.
            The default is 0.
        :param endchar: the index into ``text`` at which the fragment ends.
            The default is -1, which is interpreted as the length of ``text``.
        """

        self.text = text
        self.matches = matches

        if endchar == -1:
            endchar = len(text)
        self.startchar = startchar
        self.endchar = endchar

        self.matched_terms = set()
        for t in matches:
            if hasattr(t, "text"):
                self.matched_terms.add(t.text)
def __init__ ( self , text , matches , startchar = 0 , endchar = - 1 ) : self . text = text self . matches = matches if endchar == - 1 : endchar = len ( text ) self . startchar = startchar self . endchar = endchar self . matched_terms = set ( ) for t in matches : if hasattr ( t , "text" ) : self . matched_terms . add ( t . text )