Exemple #1
0
def main():
    """Executes the filtering process and writes the output to a file.
    """
    # Reading Configurations.
    config = ConfigParser.ConfigParser()
    config.read(common.CONFIGURATION)

    ifo_file = config.get('synonymy', 'ifo_file')
    idx_file = config.get('synonymy', 'idx_file')
    dict_file = config.get('synonymy', 'dict_file')
    karav_json = config.get('synonymy', 'karav_json')
    karav_txt = config.get('synonymy', 'karav_txt')


    step_1 = filter_1(ifo_file, idx_file, dict_file, karav_txt)
    step_2 = filter_2(step_1, karav_txt)
    common.to_json_and_txt(step_2, karav_json, karav_txt)
Exemple #2
0
def main():
    """Executes the filtering process and writes the output to a file.

    Opens Poluha's Dictionary of Antonyms and applies the  filters
    to the raw text and writes the extracted data in *.txt and *.json
    to files provided in poluha_json and poluha_txt global variables.
    """
    config = ConfigParser.ConfigParser()
    config.read(common.CONFIGURATION)

    poluha_antonyms = config.get('antonymy', 'poluha_antonyms')
    poluha_json = config.get('antonymy', 'poluha_json')
    poluha_txt = config.get('antonymy', 'poluha_txt')


    with codecs.open(poluha_antonyms, encoding='utf-8')as raw_dict:
        dic = raw_dict.readlines()
    step_1 = filter_1(filter_1(dic))
    step_2 = filter_2(step_1)

    common.to_json_and_txt(step_2, poluha_json, poluha_txt)