Esempio n. 1
0
def test_classic_lm():
    train_pos = FileCorpusSource(data.LM_TRAIN_POSITIVE).entries()
    train_neg = FileCorpusSource(data.LM_TRAIN_NEGATIVE).entries()

    test_pos = FileCorpusSource(data.LM_TEST_POSITIVE).entries()
    test_neg = FileCorpusSource(data.LM_TEST_NEGATIVE).entries()

    run_classic(
        train_pos, 
        train_neg, 
        test_pos, 
        test_neg,
        verbose=False
    )
Esempio n. 2
0
def test_classic_lm_filtered():
    train_pos = filter_lines(FileCorpusSource(data.LM_TRAIN_POSITIVE).entries(), positive_emoji)
    train_neg = filter_lines(FileCorpusSource(data.LM_TRAIN_NEGATIVE).entries(), negative_emoji)

    test_pos = filter_lines(FileCorpusSource(data.LM_TEST_POSITIVE).entries(), positive_emoji)
    test_neg = filter_lines(FileCorpusSource(data.LM_TEST_NEGATIVE).entries(), negative_emoji)

    run_classic(
        train_pos, 
        train_neg, 
        test_pos, 
        test_neg,
        verbose=False
    )
Esempio n. 3
0
def test_classic_rt():
    positive_training_corpus = itertools.chain(*[
        FileCorpusSource(data.RT_CORPUS_FILE_POSITIVE).entries(),
        FileCorpusSource(data.BIASED_FILE_POSITIVE).entries(),        
    ])
    negative_training_corpus = itertools.chain(*[
        FileCorpusSource(data.RT_CORPUS_FILE_NEGATIVE).entries(),
        FileCorpusSource(data.BIASED_FILE_NEGATIVE).entries(),        
    ])

    positive_test_corpus = FileCorpusSource(data.TEST_FILE_POSITIVE).entries()
    negative_test_corpus = FileCorpusSource(data.TEST_FILE_NEGATIVE).entries()

    run_classic(
        positive_training_corpus, 
        negative_training_corpus, 
        positive_test_corpus, 
        negative_test_corpus,
        verbose=False
    )