(word)
return [word]
Given an English word, returns a collection of morphological variations
    on the word by algorithmically adding and removing suffixes. The variation
    list may contain non-words (e.g. render -> renderment).

    >>> variations("pull")
    set(['pull', 'pullings', 'pullnesses', 'pullful', 'pullment', 'puller', ... ])
Given an English word, returns a collection of morphological variations
    on the word by algorithmically adding and removing suffixes. The variation
    list may contain non-words (e.g. render -> renderment).
Given an English word returns a collection of morphological variations on the word by algorithmically adding and removing suffixes . The variation list may contain non - words ( e . g . render - > renderment ) .
def variations(word):
    """Given an English word, returns a collection of morphological variations
    on the word by algorithmically adding and removing suffixes. The variation
    list may contain non-words (e.g. render -> renderment).

    >>> variations("pull")
    set(['pull', 'pullings', 'pullnesses', 'pullful', 'pullment', 'puller', ... ])
    """

    if word in _exdict:
        return _exdict[word].split(" ")

    for i, p in enumerate(_partitions):
        match = p.search(word)
        if match:
            # Get the named group that matched
            num = int([k for k, v in iteritems(match.groupdict())
                       if v is not None and k.startswith("_g")][0][2:])
            # Get the positional groups for the matched group (all other
            # positional groups are None)
            groups = [g for g in match.groups() if g is not None]
            ending = groups[-1]
            root = word[:0 - len(ending)] if ending else word

            out = set((word,))
            results = rules[i * _partition_size + num][1]
            for result in results.split(","):
                if result.startswith("&"):
                    out.add(root + root[-1] + result[1:])
                elif result.startswith("*"):
                    out.union(variations(root + result[1:]))
                else:
                    out.add(root + result)
            return set(out)

    return [word]
def variations ( word ) : if word in _exdict : return _exdict [ word ] . split ( " " ) for i , p in enumerate ( _partitions ) : match = p . search ( word ) if match : # Get the named group that matched num = int ( [ k for k , v in iteritems ( match . groupdict ( ) ) if v is not None and k . startswith ( "_g" ) ] [ 0 ] [ 2 : ] ) # Get the positional groups for the matched group (all other # positional groups are None) groups = [ g for g in match . groups ( ) if g is not None ] ending = groups [ - 1 ] root = word [ : 0 - len ( ending ) ] if ending else word out = set ( ( word , ) ) results = rules [ i * _partition_size + num ] [ 1 ] for result in results . split ( "," ) : if result . startswith ( "&" ) : out . add ( root + root [ - 1 ] + result [ 1 : ] ) elif result . startswith ( "*" ) : out . union ( variations ( root + result [ 1 : ] ) ) else : out . add ( root + result ) return set ( out ) return [ word ]