示例#1
0
    def interpret(self, match):
        movie = IsMovie() + HasActor(match.actor)
        movie_name = NameOf(movie)
        name_dir = ''.join(match.actor.nodes[0][1][1].split('"')[:-1])
        names = name_dir.split()
        if u"recent" in [k.lemma for k in match.words]:
            movie_name.head = "a.name,a.surname,a.title"

            if len(names) == 1:
                movie_name.nodes = [
                    u' name like "' + names + '" and  b.year>YEAR(curdate())-2'
                ]
            else:
                movie_name.nodes = [
                    u' name like "' + u" ".join(names[:-1]) +
                    u'" and surname like "' + names[-1] +
                    '" and  b.year>YEAR(curdate())-2'
                ]
            movie_name.head = u"a.title"
            movie_name.tables = [
                "actors as a left join movies as b on(a.movie_id=b.id) ",
                "actresses as a left join movies as b on(a.movie_id=b.id) "
            ]
            #print("definition ",definition)

        else:
            movie_name.tables = ["actors", "actresses"]
            movie_name.head = "title,name,surname"
            if len(names) == 1:
                movie_name.nodes = [u' name like "' + names + '"']
            else:
                movie_name.nodes = [
                    u' name like "' + u" ".join(names[:-1]) +
                    u'" and surname like "' + names[-1] + '"'
                ]
        return movie_name, ("enum", "ActedOnQuestion")
示例#2
0
 def interpret(self, match):
     show = IsTvShow() + HasActor(match.actor)
     show_name = ShowNameOf(show)
     return show_name, "enum"
示例#3
0
 def interpret(self, match):
     movie = IsMovie() + HasActor(match.actor)
     movie_name = NameOf(movie)
     print(movie_name.__dict__)
     return movie_name, "enum"
示例#4
0
 def interpret(self, match):
     _actor, i, j = match.actor
     movie = IsMovie() + HasActor(_actor)
     movie_name = NameOf(movie)
     return movie_name, ReturnValue(i, j)
示例#5
0
 def interpret(self, match):
     movie = IsMovie() + HasActor(match.actor)
     movie_name = LabelOf(movie)
     return movie_name, "enum"
示例#6
0
 def interpret(self, match):
     _actor, i, j = match.actor
     show = IsTvShow() + HasActor(_actor)
     show_name = ShowNameOf(show)
     return show_name, ReturnValue(i, j)