Ejemplo n.º 1
0
sys.path.append('/Users/oliverfengpet/Program/nlp/python_parser/no_index/libsvm-3.12/python/')
sys.path.append('/Users/oliverfengpet/Dropbox/TwitterAffect/liblinear-1.93/python')
from svmutil import *
from liblinearutil import *
# define (url -> python) mapping in urls.py

 # (r'^$', index.print_welcome)
 # http://127.0.0.1:8000/
happy_model = svm_load_model('libsvm_SVC_stem_emoticons_Happy.model')
sad_model = svm_load_model('libsvm_SVC_stem_emoticons_Sad.model')
ashamed_model = svm_load_model('libsvm_SVC_stem_emoticons_Ashamed.model')
angry_model = svm_load_model('libsvm_SVC_stem_emoticons_Angry.model')
afraid_model = svm_load_model('libsvm_SVC_stem_emoticons_Afraid.model')
model = load_model('libsvm_SVC_Mix.model')
bi = Mix_IG.load_bi("IG_Bigram.txt")
fs = Mix_IG.create_feature_space_IG(bi)
def print_welcome(request):
    html = "<html>" + get_style() + \
           "<body><div id=\"wrapper\">" \
           "CIS630 Project 2 - Twitter Affect" + \
           "<br>Tao Feng Shang CC le ya!" + \
           "<br><a href=\"crawler\">See Random Tweets Classification</a>" \
           "</div></body></html>"

    return HttpResponse(html)


#  (r'^crawler/$', index.print_crawling)
#   http://127.0.0.1:8000/crawler/

def print_crawling(request):