本文整理汇总了Python中movie.Movie.get_parental_rating方法的典型用法代码示例。如果您正苦于以下问题:Python Movie.get_parental_rating方法的具体用法?Python Movie.get_parental_rating怎么用?Python Movie.get_parental_rating使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类movie.Movie
的用法示例。
在下文中一共展示了Movie.get_parental_rating方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: movie
# 需要导入模块: from movie import Movie [as 别名]
# 或者: from movie.Movie import get_parental_rating [as 别名]
def movie(sentence):
sentence = sentence.lower()
movie_list = []
m = Movie()
parental_rating(sentence, m)
genre(sentence, m)
directors(sentence, m)
stars(sentence, m)
p = m.get_parental_rating() == ''
g = m.get_genre() == []
d = m.get_directors() == []
s = m.get_stars() == []
for movie in allmovies:
parental_rating_pass = p
genre_pass = g
director_pass = d
stars_pass = s
if not parental_rating_pass:
parental_rating_pass = m.get_parental_rating() == movie[2]
if not genre_pass:
for m_genre in m.get_genre():
genre_pass = m_genre in movie[4].lower()
if not director_pass:
i = 1
if movie[6].lower() != '':
temp = movie[6].lower().split(', ')
for actor in temp:
director_pass = actor in m.get_directors()[i-1].lower()
if director_pass:
break;
while i < len(m.get_directors()):
temp1 = False
temp2 = False
for actor in temp:
temp1 = actor in m.get_directors()[i-1].lower()
if temp1:
break;
for actor in temp:
temp2 = actor in m.get_directors()[i+1].lower()
if temp2:
break;
if m.get_directors()[i].lower() == 'and':
director_pass = temp1 and temp2
elif m.get_directors()[i].lower() == 'or':
director_pass = temp1 or temp2
if director_pass and i + 2 < len(m.get_directors()) and m.get_directors()[i + 2].lower() == 'or':
break;
i += 2
if not stars_pass:
i = 1
if movie[8].lower() != '':
temp = movie[8].lower().split(', ')
for actor in temp:
stars_pass = actor in m.get_stars()[i-1].lower()
if stars_pass:
break;
while i < len(m.get_stars()):
temp1 = False
temp2 = False
for actor in temp:
temp1 = actor in m.get_stars()[i-1].lower()
if temp1:
break;
for actor in temp:
temp2 = actor in m.get_stars()[i+1].lower()
if temp2:
break;
if m.get_stars()[i].lower() == 'and':
stars_pass = temp1 and temp2
elif m.get_stars()[i].lower() == 'or':
stars_pass = temp1 or temp2
if stars_pass and i + 2 < len(m.get_stars()) and m.get_stars()[i + 2].lower() == 'or':
break;
i += 2
if parental_rating_pass and genre_pass and director_pass and stars_pass:
if p and g and d and s:
return check_product([], sentence, p, g, d, s)
movie_list.append(movie[1])
return check_product(movie_list, sentence, p, g, d, s)