def extract_action(self, words): """ Извлекает сказуемое из списка слов (предполагается, что подлежащее уже извлечено). """ variants = self.knowledge.get_part_of_speech_(words.pop(0)) if 'verb' in variants: verb = variants['verb'][0][0] if verb is self.knowledge.to_do: if len(words) > 0 and words[0] == 'not': words.pop(0) res = self.extract_action(words) res.set_negative(True) return res res = Action(verb, **(variants['verb'][0][1])) res.set_direct_object(self.extract_object(words)) return res else: raise AIException(u'not an action')