def gaussian_BOW(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, 1)
    meanVarDictNEG = calcMean_Var(trainDataNeg, 1)
    testWordFreq = {}
    for review in reviewList:
        wordsInReview = extractCleanWords(review)
        for word in wordsInReview:
            if ((word in meanVarDictPOS) or (word in meanVarDictNEG)):
                if (word in testWordFreq):
                    testWordFreq[word] += 1
                else:
                    testWordFreq[word] = 1
    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])))) - (((testWordFreq[word] - meanVarDictPOS[word][0]) ** 2) / (meanVarDictPOS[word][1] ** 2)))
            if (word in meanVarDictNEG):
                probNeg += (math.log((1 / math.sqrt(((2 * math.pi) * meanVarDictNEG[word][1])))) - (((testWordFreq[word] - meanVarDictNEG[word][0]) ** 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_BOW(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, 1)
    meanVarDictNEG = calcMean_Var(trainDataNeg, 1)
    testWordFreq = {}
    for review in reviewList:
        wordsInReview = extractCleanWords(review)
        for word in wordsInReview:
            if ((word in meanVarDictPOS) or (word in meanVarDictNEG)):
                if (word in testWordFreq):
                    testWordFreq[word] += 1
                else:
                    testWordFreq[word] = 1
    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])))) - (((testWordFreq[word] - meanVarDictPOS[word][0]) ** 2) / (meanVarDictPOS[word][1] ** 2)))
            if (word in meanVarDictNEG):
                probNeg += (math.log((1 / math.sqrt(((2 * math.pi) * meanVarDictNEG[word][1])))) - (((testWordFreq[word] - meanVarDictNEG[word][0]) ** 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))