def gaussian_tf_idf(trainDataPos, trainDataNeg, testData, c):
    testFile = testData
    with open(testFile, 'r', encoding='utf8') as file:
        txt = file.read().replace('\n', '')
    reviewList = txt.split('<br /><br />')
    for review in reviewList:
        review = re.sub('[^\\w\\s]', '', review)
    prediction = []
    meanVarDictPOS = calcMean_Var(trainDataPos, 0)
    meanVarDictNEG = calcMean_Var(trainDataNeg, 0)
    (testSparseTFIDF, testVocabDict, testNumReviews) = tf_idf(testData)
    for review in reviewList:
        wordsInReview = list(set(extractCleanWords(review)))
        probPos = 0
        probNeg = 0
        for word in wordsInReview:
            if (word in meanVarDictPOS):
                probPos += (math.log((1 / math.sqrt(((2 * math.pi) * meanVarDictPOS[word][1])))) - (((testVocabDict[word] - meanVarDictPOS[word][0]) ** 2) / (2 * (meanVarDictPOS[word][1] ** 2))))
            if (word in meanVarDictNEG):
                probNeg += (math.log((1 / math.sqrt(((2 * math.pi) * meanVarDictNEG[word][1])))) - (((testVocabDict[word] - meanVarDictNEG[word][0]) ** 2) / (2 * (meanVarDictNEG[word][1] ** 2))))
        if (probPos > probNeg):
            prediction.append(1)
        else:
            prediction.append(0)
    poss = 0
    for p in prediction:
        if (p == c):
            poss += 1
    return (poss / len(prediction))
def gaussian_tf_idf(trainDataPos, trainDataNeg, testData, c):
    testFile = testData
    with open(testFile, 'r', encoding='utf8') as file:
        txt = file.read().replace('\n', )
    reviewList = txt.split('<br /><br />')
    for review in reviewList:
        review = re.sub('[^\\w\\s]', , review)
    prediction = []
    meanVarDictPOS = calcMean_Var(trainDataPos, 0)
    meanVarDictNEG = calcMean_Var(trainDataNeg, 0)
    (testSparseTFIDF, testVocabDict, testNumReviews) = tf_idf(testData)
    for review in reviewList:
        wordsInReview = list(set(extractCleanWords(review)))
        probPos = 0
        probNeg = 0
        for word in wordsInReview:
            if (word in meanVarDictPOS):
                probPos += (math.log((1 / math.sqrt(((2 * math.pi) * meanVarDictPOS[word][1])))) - (((testVocabDict[word] - meanVarDictPOS[word][0]) ** 2) / (2 * (meanVarDictPOS[word][1] ** 2))))
            if (word in meanVarDictNEG):
                probNeg += (math.log((1 / math.sqrt(((2 * math.pi) * meanVarDictNEG[word][1])))) - (((testVocabDict[word] - meanVarDictNEG[word][0]) ** 2) / (2 * (meanVarDictNEG[word][1] ** 2))))
        if (probPos > probNeg):
            prediction.append(1)
        else:
            prediction.append(0)
    poss = 0
    for p in prediction:
        if (p == c):
            poss += 1
    return (poss / len(prediction))