texttaglib/elan.py
def parse_eaf_stream(eaf_stream):
    ''' Parse an EAF text stream and return an ELAN object

    :param eaf_stream: a text-based stream object
    :type eaf_stream: Text I/O
    :return: an ELANDoc object
    :rtype: texttaglib.elan.ELANDoc
    '''
    elan_doc = ELANDoc()
    current_tier = None
    for event, elem in ET.iterparse(eaf_stream, events=('start', 'end')):
        if event == 'start':
            if elem.tag == 'ANNOTATION_DOCUMENT':
                elan_doc._update_info_xml(elem)
            elif elem.tag == 'TIER':
                current_tier = elan_doc._add_tier_xml(elem)
        elif event == 'end':
            if elem.tag == 'HEADER':
                elan_doc._update_header_xml(elem)
                elem.clear()  # no need to keep header node in memory
            elif elem.tag == 'TIME_SLOT':
                elan_doc._add_timeslot_xml(elem)
                elem.clear()
            elif elem.tag == 'ANNOTATION':
                current_tier._add_annotation_xml(elem)
                elem.clear()
            elif elem.tag == 'LINGUISTIC_TYPE':
                elan_doc._add_linguistic_type_xml(elem)
                elem.clear()
            elif elem.tag == 'CONSTRAINT':
                elan_doc._add_constraint_xml(elem)
                elem.clear()
            elif elem.tag == 'CONTROLLED_VOCABULARY':
                elan_doc._add_vocab_xml(elem)
                elem.clear()
    __resolve(elan_doc)  # link parts together
    return elan_doc
 Parse an EAF text stream and return an ELAN object

    :param eaf_stream: a text-based stream object
    :type eaf_stream: Text I/O
    :return: an ELANDoc object
    :rtype: texttaglib.elan.ELANDoc
    
Parse an EAF text stream and return an ELAN object
Parse an EAF text stream and return an ELAN object
def parse_eaf_stream(eaf_stream):
    elan_doc = ELANDoc()
    current_tier = None
    for event, elem in ET.iterparse(eaf_stream, events=('start', 'end')):
        if event == 'start':
            if elem.tag == 'ANNOTATION_DOCUMENT':
                elan_doc._update_info_xml(elem)
            elif elem.tag == 'TIER':
                current_tier = elan_doc._add_tier_xml(elem)
        elif event == 'end':
            if elem.tag == 'HEADER':
                elan_doc._update_header_xml(elem)
                elem.clear()  
            elif elem.tag == 'TIME_SLOT':
                elan_doc._add_timeslot_xml(elem)
                elem.clear()
            elif elem.tag == 'ANNOTATION':
                current_tier._add_annotation_xml(elem)
                elem.clear()
            elif elem.tag == 'LINGUISTIC_TYPE':
                elan_doc._add_linguistic_type_xml(elem)
                elem.clear()
            elif elem.tag == 'CONSTRAINT':
                elan_doc._add_constraint_xml(elem)
                elem.clear()
            elif elem.tag == 'CONTROLLED_VOCABULARY':
                elan_doc._add_vocab_xml(elem)
                elem.clear()
    __resolve(elan_doc)  
    return elan_doc
def parse_eaf_stream ( eaf_stream ) : elan_doc = ELANDoc ( ) current_tier = None for event , elem in ET . iterparse ( eaf_stream , events = ( 'start' , 'end' ) ) : if event == 'start' : if elem . tag == 'ANNOTATION_DOCUMENT' : elan_doc . _update_info_xml ( elem ) elif elem . tag == 'TIER' : current_tier = elan_doc . _add_tier_xml ( elem ) elif event == 'end' : if elem . tag == 'HEADER' : elan_doc . _update_header_xml ( elem ) elem . clear ( ) elif elem . tag == 'TIME_SLOT' : elan_doc . _add_timeslot_xml ( elem ) elem . clear ( ) elif elem . tag == 'ANNOTATION' : current_tier . _add_annotation_xml ( elem ) elem . clear ( ) elif elem . tag == 'LINGUISTIC_TYPE' : elan_doc . _add_linguistic_type_xml ( elem ) elem . clear ( ) elif elem . tag == 'CONSTRAINT' : elan_doc . _add_constraint_xml ( elem ) elem . clear ( ) elif elem . tag == 'CONTROLLED_VOCABULARY' : elan_doc . _add_vocab_xml ( elem ) elem . clear ( ) __resolve ( elan_doc ) return elan_doc
Parse an EAF text stream and return an ELAN object
Parse an EAF text stream and return an ELAN object
''' Parse an EAF text stream and return an ELAN object

    :param eaf_stream: a text-based stream object
    :type eaf_stream: Text I/O
    :return: an ELANDoc object
    :rtype: texttaglib.elan.ELANDoc
    ''' # no need to keep header node in memory # link parts together
an ELANDoc object
an ELANDoc object
texttaglib.elan.ELANDoc
eaf_stream
a text-based stream object
a text - based stream object