'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*, PR*.
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").'

def match(self, word):

    if ((self.custom is not None) and (self.custom(word) is False)):
        return False
    if (self.first and (word.index > 0)):
        return False
    if (self.exclude and self.exclude.match(word)):
        return False
    if self.tags:
        if (find((lambda w: _match(word.tag, w)), self.tags) is None):
            return False
    if self.chunks:
        ch = ((word.chunk and word.chunk.tag) or None)
        if (find((lambda w: _match(ch, w)), self.chunks) is None):
            return False
    if self.roles:
        R = ((word.chunk and [r2 for (r1, r2) in word.chunk.relations]) or [])
        if (find((lambda w: (w in R)), self.roles) is None):
            return False
    b = True
    if ((len(self.words) + len(self.taxa)) > 0):
        s1 = word.string.lower()
        s2 = word.lemma
        b = False
        for w in itertools.chain(self.words, self.taxa):
            try:
                if (('    ' in w) and ((s1 in w) or (s2 and (s2 in w)) or ('*' in w))):
                    s1 = ((word.chunk and word.chunk.string.lower()) or s1)
                    s2 = ((word.chunk and '    '.join(((x or '') for x in word.chunk.lemmata))) or s2)
            except Exception as e:
                s1 = s1
                s2 = None
            if _match(s1, w):
                b = True
                break
            if (s2 and _match(s2, w)):
                b = True
                break
    if (self.taxa and ((not self.words) or (self.words and (not b)))):
        for s in (word.string, word.lemma, ((word.chunk and word.chunk.string) or None), ((word.chunk and '    '.join([(x or '') for x in word.chunk.lemmata])) or None)):
            if (s is not None):
                if (self.taxonomy.case_sensitive is False):
                    s = s.lower()
                for p in self.taxonomy.parents(s, recursive=True):
                    if find((lambda s: (p == s)), self.taxa):
                        return True
    return b
