def rule(verb, no, obj): """ neg_action : VERB NOT object """ if verb.base != 'be': raise AISyntaxError("Expected *be* in negation.") action = Action(verb.word, **verb.form) action.set_negative(True) action.objects[''] = obj return action
class PossessionImplementation(AttributeImplementation): def __str__(self): form = merge_dicts(self.form, {'common':False}) return self.concept.word.to_string(**form) class OtherAttributeImplementation(AttributeImplementation): def __str__(self): return self.concept.word.to_string(**self.form) from gnTai.concepts.attribute import Possession, OtherAttribute from gnTai.concepts.object import Object from gnTai.concepts.action import Action from gnTai.thoughts.thought import Thought Possession.english_implement = PossessionImplementation.get_implementer() OtherAttribute.english_implement= OtherAttributeImplementation.get_implementer() Object.english_implement = ObjectImplementation.get_implementer() Action.english_implement = ActionImplementation.get_implementer() if __name__ == '__main__': from gnTai.thoughts.thought import Thought from gnTai.concepts.object import Object from gnTai.concepts.action import Action from words.noun import Noun from words.verb import Verb obj = Object(Noun("apple")) action = Action(to_be, objects={'':Object(Noun('fruit'))}) action.set_negative() thought = Thought(obj, action) print ThoughtImplementation(thought)