Beispiel #1
0
def train():
    #Pre-process tweets
    #wordId,tweetId=tp.process(1)
    #TF-IDF
    #docwords,docCatIds=svmp.cacheTweetsInList(wordId,tweetId,flow)
    #SVM Processing
    #1. Create libSVM file
    #svmp.createTrainFile(docwords,docCatIds,tweetId)
    #2. Train the SVM
    #svmp.trainSVM()
    svmp.trainliblinear()
Beispiel #2
0
def classify():
    labels =[]
    #sampletext = request.form.get('txt1')

    wordId,tweetId=tp.process(2)
    #TF-IDF
    docwords,docCatIds=svmp.cacheTweetsInList(wordId,tweetId,2)
    #SVM Processing
    #1. Create libSVM file
    svmp.createTestFile(docwords,docCatIds,tweetId)
    #2. Train the SVM
    #svmp.trainLibLinear()
    labels = svmp.testSVM(1)
    #clean_dict(start_pos,end_pos)
    return labels
Beispiel #3
0
def classify(flag=None):
    #Pre-process tweets
    wordId,tweetId=tp.process(2)
    #TF-IDF
    docwords,docCatIds=svmp.cacheTweetsInList(wordId,tweetId,2)
    #SVM Processing
    #1. Create libSVM file
    svmp.createTestFile(docwords,docCatIds,tweetId)
    #2. Train the SVM
    if flag is not None:
        return svmp.testSVM(1)
    else:
        svmp.testSVM()