Ejemplo n.º 1
0
def main():
    from altbayes import classify, train 
    train()
    fscore(classify, get_paths())
def main():
    from altbayes import classify, train
    train()
    fscore(classify, get_paths())
Ejemplo n.º 3
0
def test_pang_lee():
    """
    Tests the Pang Lee dataset
    """
    total, correct = 0, 0
    for fname in os.listdir("txt_sentoken/pos"):
        correct += int(classify2(open("txt_sentoken/pos/" + fname).read()) == True)
        total += 1
    for fname in os.listdir("txt_sentoken/neg"):
        correct += int(classify2(open("txt_sentoken/neg/" + fname).read()) == False)
        total += 1
    print "accuracy: %f" % (correct / total)

if __name__ == '__main__':
    train()
    feature_selection_trials()
    # test_pang_lee()
    # classify_demo(open("pos_example").read())
    # classify_demo(open("neg_example").read())

########NEW FILE########
__FILENAME__ = metric
"""
F-Score metrics for testing classifier, also includes functions for data extraction.
Author: Vivek Narayanan
"""
import os

def get_paths():
    """