Example #1
0
def getTopLevelQuestion(word, subreddit):
    searchTerm = 'subreddit:'+subreddit+" "+word
    results = search(searchTerm)
    questions = []
    for result in results:
        submission = r.get_submission(url = result['permalink'])
        question = filters.build_Text(submission.title, 'Question')
        print question['Text']
        question['selftext'] = filters.build_Text(submission.selftext, 'Question')
        comments = submission.comments
        for comment in comments:
            if isinstance(comment, praw.objects.Comment):
                question['Answers'].append(comment)
        question = filters.my_rank_question(question)
        if question:
            questions.append(question)
    return questions
Example #2
0
def getTopLevelQuestion(word, subreddit):
    searchTerm = 'subreddit:' + subreddit + " " + word
    results = search(searchTerm)
    questions = []
    for result in results:
        submission = r.get_submission(url=result['permalink'])
        question = filters.build_Text(submission.title, 'Question')
        print(question['Text'])
        question['selftext'] = filters.build_Text(submission.selftext,
                                                  'Question')
        comments = submission.comments
        for comment in comments:
            if isinstance(comment, praw.objects.Comment):
                question['Answers'].append(comment)
        question = filters.my_rank_question(question)
        if question:
            questions.append(question)
    return questions
Example #3
0
def getNextLevel(question, emotion):
    if emotion == 'Dirty':
        responses = question['DirtyAnswers']
    elif emotion == 'Snarky':
        responses = question['SnarkyAnswers']
    else:
        responses = question['GoodAnswers']
    if not responses:
    	responses = question['GoodAnswers']
    response = responses[0]
    answer = filters.build_Text(response['Text'], 'Answer')
    comments = response['CommentObj'].replies
    for comment in comments:
        if isinstance(comment, praw.objects.Comment):
            answer['Answers'].append(comment)
    answer = filters.my_rank_question(answer)
    return answer
Example #4
0
def getNextLevel(question, emotion):
    if emotion == 'Dirty':
        responses = question['DirtyAnswers']
    elif emotion == 'Snarky':
        responses = question['SnarkyAnswers']
    else:
        responses = question['GoodAnswers']
    if not responses:
        responses = question['GoodAnswers']
    response = responses[0]
    answer = filters.build_Text(response['Text'], 'Answer')
    comments = response['CommentObj'].replies
    for comment in comments:
        if isinstance(comment, praw.objects.Comment):
            answer['Answers'].append(comment)
    answer = filters.my_rank_question(answer)
    return answer