mmax2conll/mmax2conll/main.py
def read_SoNaR(cls, words_file, sentences_file,
                   validate_xml=c.VALIDATE_XML,
                   words_files_extension=c.WORDS_FILES_EXTENSION,
                   on_missing_document_ID=c.CONLL_ON_MISSING['document_id']):
        """
        Read sentences and document ID from a words_file and sentences file
        from SoNaR.

        Extracts the document ID using the file basename.
        """
        # Read document ID
        document_id = document_ID_from_filename(
            words_file,
            words_files_extension
        )
        cls.check_document_id(document_id, words_file, on_missing_document_ID)

        # Read words
        logger.debug(f"Read words of {document_id}")
        words = list(SoNaRWordsDocumentReader(
            validate=validate_xml
        ).extract_items(
            etree.parse(words_file)
        ))

        logger.debug(f"Read sentences of {document_id}")
        # Add sentence data
        sentence_items = SoNaRSentencesDocumentReader(
            words,
            validate=validate_xml
        ).extract_items(etree.parse(sentences_file))
        sentences = add_sentence_layer_to_words(words, sentence_items)
        del words, sentence_items

        add_word_numbers(sentences)

        return document_id, sentences

        Read sentences and document ID from a words_file and sentences file
        from SoNaR.

        Extracts the document ID using the file basename.
        
Read sentences and document ID from a words_file and sentences file
from SoNaR.

Extracts the document ID using the file basename.
Read sentences and document ID from a words_file and sentences file from SoNaR . Extracts the document ID using the file basename .
def read_SoNaR(cls, words_file, sentences_file,
                   validate_xml=c.VALIDATE_XML,
                   words_files_extension=c.WORDS_FILES_EXTENSION,
                   on_missing_document_ID=c.CONLL_ON_MISSING['document_id']):
        document_id = document_ID_from_filename(
            words_file,
            words_files_extension
        )
        cls.check_document_id(document_id, words_file, on_missing_document_ID)
        logger.debug(f"Read words of {document_id}")
        words = list(SoNaRWordsDocumentReader(
            validate=validate_xml
        ).extract_items(
            etree.parse(words_file)
        ))
        logger.debug(f"Read sentences of {document_id}")
        sentence_items = SoNaRSentencesDocumentReader(
            words,
            validate=validate_xml
        ).extract_items(etree.parse(sentences_file))
        sentences = add_sentence_layer_to_words(words, sentence_items)
        del words, sentence_items
        add_word_numbers(sentences)
        return document_id, sentences
def read_SoNaR ( cls , words_file , sentences_file , validate_xml = c . VALIDATE_XML , words_files_extension = c . WORDS_FILES_EXTENSION , on_missing_document_ID = c . CONLL_ON_MISSING [ 'document_id' ] ) : document_id = document_ID_from_filename ( words_file , words_files_extension ) cls . check_document_id ( document_id , words_file , on_missing_document_ID ) logger . debug ( f"Read words of {document_id}" ) words = list ( SoNaRWordsDocumentReader ( validate = validate_xml ) . extract_items ( etree . parse ( words_file ) ) ) logger . debug ( f"Read sentences of {document_id}" ) sentence_items = SoNaRSentencesDocumentReader ( words , validate = validate_xml ) . extract_items ( etree . parse ( sentences_file ) ) sentences = add_sentence_layer_to_words ( words , sentence_items ) del words , sentence_items add_word_numbers ( sentences ) return document_id , sentences
Read sentences and document ID from a words_file and sentences file
from SoNaR.
Read sentences and document ID from a words_file and sentences file from SoNaR .
"""
        Read sentences and document ID from a words_file and sentences file
        from SoNaR.

        Extracts the document ID using the file basename.
        """ # Read document ID # Read words # Add sentence data
cls
words_file
sentences_file
validate_xml
words_files_extension
on_missing_document_ID