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
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