#import parser
import logging
from odwn import Wn_grid_parser
from collections import defaultdict
import os
import pickle

my_parser = Wn_grid_parser(Wn_grid_parser.odwn)
output_path = Wn_grid_parser.odwn.replace('1.1', '1.2')


def start_logger():
    '''
    start logger
    '''
    logger = logging.getLogger(__name__)
    logger.setLevel(logging.DEBUG)

    # create a file handler
    handler = logging.FileHandler(output_path + '.log', mode="w")
    handler.setLevel(logging.DEBUG)

    # create a logging format
    formatter = logging.Formatter(
        '%(filename)s - %(asctime)s - %(levelname)s - %(name)s  - %(message)s')
    handler.setFormatter(formatter)

    # add the handlers to the logger
    logger.addHandler(handler)

    logger.info('started creating version 1.2')
with open('log.txt','w') as outfile:
    outfile.close()

def log_it(message):
    with open("log.txt","a") as outfile:
        outfile.write(str(datetime.now())+"\t"+message+"\n")
#here
cwd             = os.path.dirname(os.path.realpath(__file__))
omegawiki       = "{cwd}/odwn/resources/wn-omegawiki-nld.txt".format(**locals())
wiktionary      = "{cwd}/odwn/resources/wn-wiktionary-nld.txt".format(**locals())
google          = "{cwd}/odwn/resources/wn-google-nld.txt".format(**locals())

#load it
log_it("starting")

instance = Wn_grid_parser(Wn_grid_parser.odwn)

log_it("start cleaning")

#clean it
instance.clean()

log_it('done cleaning')
#remove all babelnet + wiktionary + google_api results
for resource in ['babelnet','google_api','wiktionary']:
    log_it("removing %s" % resource)
    instance.les_remove_a_resource(resource)

#add results antoni + google monosemous results
def add_antoni():
    pos_dict = {'n':'noun','v':'verb'}
Esempio n. 3
0
def log_it(message):
    with open("log.txt", "a") as outfile:
        outfile.write(str(datetime.now()) + "\t" + message + "\n")


#here
cwd = os.path.dirname(os.path.realpath(__file__))
omegawiki = "{cwd}/odwn/resources/wn-omegawiki-nld.txt".format(**locals())
wiktionary = "{cwd}/odwn/resources/wn-wiktionary-nld.txt".format(**locals())
google = "{cwd}/odwn/resources/wn-google-nld.txt".format(**locals())

#load it
log_it("starting")

instance = Wn_grid_parser(Wn_grid_parser.odwn)

log_it("start cleaning")

#clean it
instance.clean()

log_it('done cleaning')
#remove all babelnet + wiktionary + google_api results
for resource in ['babelnet', 'google_api', 'wiktionary']:
    log_it("removing %s" % resource)
    instance.les_remove_a_resource(resource)


#add results antoni + google monosemous results
def add_antoni():
Esempio n. 4
0
from odwn import Wn_grid_parser

instance = Wn_grid_parser(Wn_grid_parser.odwn)
instance.orbn_search()
#import parser
import logging
from odwn import Wn_grid_parser
from collections import defaultdict 
import os 
import pickle

my_parser = Wn_grid_parser(Wn_grid_parser.odwn)
output_path = Wn_grid_parser.odwn.replace('1.1','1.2')

def start_logger():
    '''
    start logger
    '''
    logger = logging.getLogger(__name__)
    logger.setLevel(logging.DEBUG)

# create a file handler
    handler = logging.FileHandler(output_path+'.log',mode="w")
    handler.setLevel(logging.DEBUG)

# create a logging format
    formatter = logging.Formatter('%(filename)s - %(asctime)s - %(levelname)s - %(name)s  - %(message)s')
    handler.setFormatter(formatter)

    # add the handlers to the logger
    logger.addHandler(handler)
    
    logger.info('started creating version 1.2')
    return logger