示例#1
0
def reviews_rating(movie_id):
    try:
        positive_reviews,neutral_reviews,negative_reviews = comments_analysis.get_movie_reviews(movie_id=movie_id)
        rating = rating_calculation.calculate_rating(positive_reviews=positive_reviews,negative_reviews=negative_reviews)
        return rating
        # {'Success':True,
        # 'Rating':rating}
    except:
        raise DoesNotExist("Movie does not exist")
示例#2
0
def reviews_rating(movie_id):
    try:
        positive_reviews, neutral_reviews, negative_reviews = comments_analysis.get_movie_reviews(
            movie_id=movie_id)
        rating = rating_calculation.calculate_rating(
            positive_reviews=positive_reviews,
            negative_reviews=negative_reviews)
        return rating
        # {'Success':True,
        # 'Rating':rating}
    except:
        raise DoesNotExist("Movie does not exist")
示例#3
0
def top_movie_reviews(movie_id,offset=0,limit=10):
    try:
        positive_reviews,neutral_reviews,negative_reviews = comments_analysis.get_movie_reviews(movie_id=movie_id)
        if len(positive_reviews)==0 and len(neutral_reviews)==0 and len(negative_reviews)==0:
            return {'Body': 'No reviews'}

        return {'Success':True,
                'positive_reviews':positive_reviews,
                'neutral_reviews':neutral_reviews,
                'negative_reviews':negative_reviews
               }
    except:
        raise DoesNotExist("Movie does not exist")
示例#4
0
def top_movie_reviews(movie_id, offset=0, limit=10):
    try:
        positive_reviews, neutral_reviews, negative_reviews = comments_analysis.get_movie_reviews(
            movie_id=movie_id)
        if len(positive_reviews) == 0 and len(neutral_reviews) == 0 and len(
                negative_reviews) == 0:
            return {'Body': 'No reviews'}

        return {
            'Success': True,
            'positive_reviews': positive_reviews,
            'neutral_reviews': neutral_reviews,
            'negative_reviews': negative_reviews
        }
    except:
        raise DoesNotExist("Movie does not exist")