Exemple #1
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()
Exemple #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