コード例 #1
0
ファイル: views.py プロジェクト: ryan-hansen/TagJungle
def search(request):
    phrase = request.GET.get('s', None)
    if phrase:
        adj = list()
        context = dict()
        ent_type = request.GET.get('t')
        ent_analyzer = WikiWrapper.search(phrase, int(ent_type))
        for res in ent_analyzer.pos_normalized['adjectives']:
            adj.append(res[0])
        context['adjectives'] = adj
        return render(request, 'search_form.tpl', context=context)
    else:
        return render(request, 'search_form.tpl')
コード例 #2
0
ファイル: tests.py プロジェクト: ryan-hansen/TagJungle
 def test_gender(self):
     mitt = WikiWrapper.search('Mitt Romney', 1)
     assert mitt.gender == constants.GENDER[0]
コード例 #3
0
ファイル: tests.py プロジェクト: mrhattyhat/TagJungle
 def test_gender(self):
     mitt = WikiWrapper.search('Mitt Romney', 1)
     assert mitt.gender == constants.GENDER[0]