Пример #1
0
 def __init__(self, wildcard, userid='*'):
     PatternNode.__init__(self, userid)
     if wildcard not in self.matching_wildcards():
         raise ParserException(
             "%s not in valid wildcards %s" %
             (wildcard, ", ".join(self.matching_wildcards())))
     self._wildcard = wildcard
Пример #2
0
 def __init__(self, attribs, text, userid='*'):
     PatternNode.__init__(self, userid)
     if 'name' in attribs:
         self._set_name = attribs['name'].upper()
     elif text:
         self._set_name = text.upper()
     else:
         raise ParserException(
             "Invalid set node, no name specified as attribute or text")
Пример #3
0
 def __init__(self, attribs, text, userid='*'):
     PatternNode.__init__(self, userid)
     if 'name' in attribs:
         self._property = attribs['name']
     elif 'property' in attribs:
         self._property = attribs['property']
     elif text:
         self._property = text
     else:
         raise ParserException(
             "Invalid bot node, neither name or property specified as attribute or text"
         )
Пример #4
0
    def __init__(self, attribs, text, userid='*'):
        PatternNode.__init__(self, userid)
        self._words = []

        if 'words' in attribs:
            words = attribs['words'].upper()
        elif text:
            words = text.upper()
        else:
            raise ParserException(
                "Invalid iset node, no words specified as attribute or text")

        self._parse_words(words)
        self._iset_name = "iset_%d" % (PatternISetNode.iset_count)
        PatternISetNode.iset_count += 1
Пример #5
0
    def __init__(self, attribs, text, userid='*'):
        PatternNode.__init__(self, userid)
        self._pattern_text = None
        self._pattern_template = None
        self._pattern = None
        if 'pattern' in attribs:
            self._pattern_text = attribs['pattern']
        elif 'template' in attribs:
            self._pattern_template = attribs['template']
        elif text:
            self._pattern_text = text
        else:
            raise ParserException("Invalid regex node, neither pattern or template specified as attribute or text")

        if self._pattern_text is not None:
            self._pattern = re.compile(self._pattern_text)
Пример #6
0
 def __init__(self, userid='*'):
     PatternNode.__init__(self, userid)
Пример #7
0
 def __init__(self, template, userid='*'):
     PatternNode.__init__(self, userid)
     self._template = template
Пример #8
0
 def __init__(self, word, userid='*'):
     PatternNode.__init__(self, userid)
     self._priority_word = word