예제 #1
0
파일: reddit.py 프로젝트: akuntz09/theater
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
예제 #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
예제 #3
0
파일: reddit.py 프로젝트: akuntz09/theater
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
예제 #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