示例#1
0
from __init__ import Wn_grid_parser

my_parser = Wn_grid_parser(Wn_grid_parser.odwn)

my_parser.omw_export()
#import parser
import logging
from __init__ import Wn_grid_parser
import os 
import pickle

path_v_12 = os.path.join(os.path.dirname(os.path.realpath(__file__)),
                         'resources',
                         'odwn',
                         'odwn_orbn_gwg-LMF_1.2.xml.gz')
my_parser = Wn_grid_parser(path_v_12)
output_path = path_v_12.replace('1.2','1.3')
output_path = output_path.strip('.gz')

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)
示例#3
0
from __init__ import Wn_grid_parser


my_parser = Wn_grid_parser(Wn_grid_parser.odwn)

my_parser.omw_export()
示例#4
0
    f = open(dtd_path)
    dtd = etree.DTD(f)
    message = ""

    succes = dtd.validate(loaded_xml)
    if not succes:
        message = dtd.error_log.filter_from_errors()[0]

    return (succes, message)


print('start', datetime.now())

dtd_path = 'resources/cili/WN-LMF-1.0.dtd'
starting_point_path = 'resources/cili/the_starting_point.xml'
old = Wn_grid_parser(Wn_grid_parser.odwn)
root = old.doc.getroot()

parser = etree.XMLParser(remove_blank_text=True)
new = etree.parse(starting_point_path, parser)
lexicon_el = new.find('Lexicon')


debug = True
# TODO: think about CDATA format for strings


# which synsets to add
added_synsets = set()
# loop through Synsets
for synset_obj in old.synsets_get_generator():
    f = open(dtd_path)
    dtd = etree.DTD(f)
    message = ""

    succes = dtd.validate(loaded_xml)
    if not succes:
        message = dtd.error_log.filter_from_errors()[0]

    return (succes, message)


print('start', datetime.now())

dtd_path = 'resources/cili/WN-LMF-1.0.dtd'
starting_point_path = 'resources/cili/the_starting_point.xml'
old = Wn_grid_parser(Wn_grid_parser.odwn)
root = old.doc.getroot()

parser = etree.XMLParser(remove_blank_text=True)
new = etree.parse(starting_point_path, parser)
lexicon_el = new.find('Lexicon')


debug = True
# TODO: think about CDATA format for strings


# which synsets to add
added_synsets = set()
# loop through Synsets
for synset_obj in old.synsets_get_generator():
示例#6
0
from __init__ import Wn_grid_parser

instance = Wn_grid_parser(Wn_grid_parser.odwn)
instance.ili_map_export()