def match(self, word):
<EOL>if self.custom is not None and self.custom(word) is False:<EOL><INDENT>return False<EOL><DEDENT>if self.first and word.index > <NUM_LIT:0>:<EOL><INDENT>return False<EOL><DEDENT>if self.exclude and self.exclude.match(word):<EOL><INDENT>return False<EOL><DEDENT>if self.tags:<EOL><INDENT>if find(lambda w: _match(word.tag, w), self.tags) is None:<EOL><INDENT>return False<EOL><DEDENT><DEDENT>if self.chunks:<EOL><INDENT>ch = word.chunk and word.chunk.tag or None<EOL>if find(lambda w: _match(ch, w), self.chunks) is None:<EOL><INDENT>return False<EOL><DEDENT><DEDENT>if self.roles:<EOL><INDENT>R = word.chunk and [r2 for r1, r2 in word.chunk.relations] or []<EOL>if find(lambda w: w in R, self.roles) is None:<EOL><INDENT>return False<EOL><DEDENT><DEDENT>b = True <EOL>if len(self.words) + len(self.taxa) > <NUM_LIT:0>:<EOL><INDENT>s1 = word.string.lower()<EOL>s2 = word.lemma<EOL>b = False<EOL>for w in itertools.chain(self.words, self.taxa):<EOL><INDENT>try:<EOL><INDENT>if "<STR_LIT:U+0020>" in w and (s1 in w or s2 and s2 in w or "<STR_LIT:*>" in w):<EOL><INDENT>s1 = word.chunk and word.chunk.string.lower() or s1<EOL>s2 = word.chunk and "<STR_LIT:U+0020>".join([x or "<STR_LIT>" for x in word.chunk.lemmata]) or s2<EOL><DEDENT><DEDENT>except:<EOL><INDENT>s1 = s1<EOL>s2 = None<EOL><DEDENT>if _match(s1, w):<EOL><INDENT>b=True; break<EOL><DEDENT>if s2 and _match(s2, w):<EOL><INDENT>b=True; break<EOL><DEDENT><DEDENT><DEDENT>if self.taxa and (not self.words or (self.words and not b)):<EOL><INDENT>for s in (<EOL>word.string, <EOL>word.lemma,  <EOL>word.chunk and word.chunk.string or None, <EOL>word.chunk and "<STR_LIT:U+0020>".join([x or "<STR_LIT>" for x in word.chunk.lemmata]) or None): <EOL><INDENT>if s is not None:<EOL><INDENT>if self.taxonomy.case_sensitive is False:<EOL><INDENT>s = s.lower()<EOL><DEDENT>for p in self.taxonomy.parents(s, recursive=True):<EOL><INDENT>if find(lambda s: p==s, self.taxa): <EOL><INDENT>return True<EOL><DEDENT><DEDENT><DEDENT><DEDENT><DEDENT>return b<EOL>
Return True if the given Word is part of the constraint:
            - the word (or lemma) occurs in Constraint.words, OR
            - the word (or lemma) occurs in Constraint.taxa taxonomy tree, AND
            - the word and/or chunk tags match those defined in the constraint.
            Individual terms in Constraint.words or the taxonomy can contain wildcards (*).
            Some part-of-speech-tags can also contain wildcards: NN*, VB*, JJ*, RB*
            If the given word contains spaces (e.g., proper noun),
            the entire chunk will also be compared.
            For example: Constraint(words=["Mac OS X*"]) 
            matches the word "Mac" if the word occurs in a Chunk("Mac OS X 10.5").