def visit(self, context):
        result = self.remove(context.current_word)
        if result != context.current_word:
            removedPart = re.sub(result, '', context.current_word, 1)

            removal = Removal(self, context.current_word, result, removedPart, 'DS')

            context.add_removal(removal)
            context.current_word = result
Example #2
0
    def visit(self, context):
        result = None

        for disambiguator in self.disambiguators:
            result = disambiguator.disambiguate(context.current_word)
            if context.dictionary.contains(result):
                break

        if not result:
            return

        removedPart = re.sub(result, '', context.current_word, 1)

        removal = Removal(self, context.current_word, result, removedPart,
                          'DP')

        context.add_removal(removal)
        context.current_word = result