Exemple #1
0
"""
include evaluation
"""
import file_operations
from config_parser import pickleFile, pickleFolder


(restaurantTrainDict, restaurantTestDict, laptopTrainDict, laptopTestDict)\
    = file_operations.loadAndGetRawDataFromPickle(pickleFolder, pickleFile)
rst_train_sentences = restaurantTrainDict['sentences']['sentence']
rst_test_sentences = restaurantTestDict['sentences']['sentence']


def put_asp_cate(aspect, category, collector):
    """

    """
    if aspect in collector:
        cate_dict = collector[aspect]
        if category in cate_dict:
            cate_dict[category] += 1
        else:
            cate_dict[category] = 1
    else:
        collector[aspect] = {}
        collector[aspect][category] = 1


def get_asp2category():
    asp_category = {}
    for sent in rst_train_sentences:
def load_train_sentences():
    (restaurantTrainDict, restaurantTestDict, laptopTrainDict, laptopTestDict) \
        = file_operations.loadAndGetRawDataFromPickle(pickleFolder, pickleFile)
    rst_train_sentences = restaurantTrainDict['sentences']['sentence']
    lptp_train_sentences = laptopTrainDict['sentences']['sentence']
    return rst_train_sentences, lptp_train_sentences