def calcMean_Var(txtFile, tfidforBOW):
    if (tfidforBOW == 1):
        (sparseMatrix, vocabDict, numReviews) = bagOfWords_GaussianNB(txtFile)
    else:
        (sparseMatrix, vocabDict, numReviews) = tf_idf(txtFile)
    meanVarDict = {}
    meanVarTouple = [0, 0]
    for word in vocabDict:
        meanVarTouple[0] = (vocabDict[word] / numReviews)
        var = 0
        for m in sparseMatrix:
            if (word in m):
                var += ((m[word] - meanVarTouple[0]) ** 2)
            else:
                var += (((- 1) * meanVarTouple[0]) ** 2)
        meanVarTouple[1] = (var / (numReviews - 1))
        meanVarDict[word] = meanVarTouple
    return meanVarDict
def calcMean_Var(txtFile, tfidforBOW):
    if (tfidforBOW == 1):
        (sparseMatrix, vocabDict, numReviews) = bagOfWords_GaussianNB(txtFile)
    else:
        (sparseMatrix, vocabDict, numReviews) = tf_idf(txtFile)
    meanVarDict = {}
    meanVarTouple = [0, 0]
    for word in vocabDict:
        meanVarTouple[0] = (vocabDict[word] / numReviews)
        var = 0
        for m in sparseMatrix:
            if (word in m):
                var += ((m[word] - meanVarTouple[0]) ** 2)
            else:
                var += (((- 1) * meanVarTouple[0]) ** 2)
        meanVarTouple[1] = (var / (numReviews - 1))
        meanVarDict[word] = meanVarTouple
    return meanVarDict