コード例 #1
0
    def parse(self, token):
        """
        For a token given, get a list of options (inflection, stem) possible.

        """
        options = FlexAutomaton.parse(self, token)
        if not self.agglutinative:
            return options
        toRemove = set()
        for flex, stem in options:
            flexPrefixes = self.prefixes.get(flex, None)
            if flexPrefixes:
                toRemove |= flexPrefixes
        options = [(flex, stem) for flex, stem in options if flex not in toRemove]
        return options