cat2naf/cat2naf_entities.py
def collect_markables(catfile):
    '''
    Function that collects markables, their type and span
    Note: assumes relevant markables are called 'NAMEDENTITY' and have an attribute 'type'
    :param catfile: CAT xml file
    :return: list of catMarkables
    '''

    my_markables = []
    #go through catfile and collect span + type of each markable

    parser = etree.XMLParser(ns_clean=True)
    cattree = etree.parse(catfile, parser)
    markables = cattree.find('Markables')
    for markable in markables.findall('NAMEDENTITY'):
        etype = markable.get('type')
        mspan = get_markable_span(markable)
        cmarkable = catMarkable(mspan, etype)
        my_markables.append(cmarkable)


    return my_markables

    Function that collects markables, their type and span
    Note: assumes relevant markables are called 'NAMEDENTITY' and have an attribute 'type'
    :param catfile: CAT xml file
    :return: list of catMarkables
    
Function that collects markables, their type and span
Note: assumes relevant markables are called 'NAMEDENTITY' and have an attribute 'type'
Function that collects markables their type and span Note : assumes relevant markables are called ' NAMEDENTITY ' and have an attribute ' type '
def collect_markables(catfile):
    my_markables = []
    parser = etree.XMLParser(ns_clean=True)
    cattree = etree.parse(catfile, parser)
    markables = cattree.find('Markables')
    for markable in markables.findall('NAMEDENTITY'):
        etype = markable.get('type')
        mspan = get_markable_span(markable)
        cmarkable = catMarkable(mspan, etype)
        my_markables.append(cmarkable)
    return my_markables
def collect_markables ( catfile ) : my_markables = [ ] parser = etree . XMLParser ( ns_clean = True ) cattree = etree . parse ( catfile , parser ) markables = cattree . find ( 'Markables' ) for markable in markables . findall ( 'NAMEDENTITY' ) : etype = markable . get ( 'type' ) mspan = get_markable_span ( markable ) cmarkable = catMarkable ( mspan , etype ) my_markables . append ( cmarkable ) return my_markables
Function that collects markables, their type and span
Note: assumes relevant markables are called 'NAMEDENTITY' and have an attribute 'type'
Function that collects markables their type and span Note : assumes relevant markables are called ' NAMEDENTITY ' and have an attribute ' type '
'''
    Function that collects markables, their type and span
    Note: assumes relevant markables are called 'NAMEDENTITY' and have an attribute 'type'
    :param catfile: CAT xml file
    :return: list of catMarkables
    ''' #go through catfile and collect span + type of each markable
list of catMarkables
list of catMarkables
catfile
CAT xml file
CAT xml file