Example #1
0
def twitgraph(request):
    bayesname = 'bayesdata'
    srch = 'happy'
    tag = 'n'
    c = BayesianClassifier()
    if not memcache.get('bayesdata'):
        c.save()  #laod form local file system
    c.load()  #load picke from memecache
    '''q=request.get_all("q")'''
    if (request.GET.has_key('q')):
        srch = request.GET['q']

    tag = c.classify(srch)
    html = "<html><body>sentiment is %s </body></html>" % tag
    #return HttpResponse(html)
    gv = globvars
    context = {'thispage': 'Sentiment', 'the_tweet': srch, 'sentmnt': tag}
    context = dict(context, **gv.context)
    return render_to_response('sentiment.html', context)
Example #2
0
def twitgraph(request):    
    bayesname='bayesdata'
    srch = 'happy'
    tag = 'n'
    c = BayesianClassifier()
    if not memcache.get('bayesdata'):       
        c.save()#laod form local file system
    c.load()#load picke from memecache
    '''q=request.get_all("q")'''
    if(request.GET.has_key('q')):
        srch = request.GET['q']    

    tag = c.classify(srch)
    html =  "<html><body>sentiment is %s </body></html>"  % tag
    #return HttpResponse(html)
    gv = globvars
    context = {
      'thispage':'Sentiment',
       'the_tweet':srch,
       'sentmnt':tag
        }
    context = dict(context, **gv.context)
    return render_to_response('sentiment.html', context)