naf2conll/naf2conll/conll_writers.py
def write(self, writeable, document_id, sentences):
        """
        Write sentences to a writeable in CoNLL format.

        Take the specified action when something is missing.

        Enforces `part_number` to be a number and to be increasing.
        Assumes all words in a sentence have the same `part_number`.
        Does not validate any other values.
        """
        prev_part = 0
        self.write_part_start(writeable, document_id, prev_part)
        for sentence in sentences:
            current_part = sentence[0].get(
                'part_number',
                None
            ) if sentence else None
            if current_part is None:
                current_part = self.defaults['part_number']
            try:
                current_part = int(current_part)
            except ValueError as e:
                raise ValueError(
                    f"The part number should be a number in : {sentence}"
                ) from e

            if prev_part != current_part:
                if prev_part > current_part:
                    raise ValueError(
                        "The part number should be a increasing in:"
                        f" {sentence}"
                    )
                while prev_part != current_part:
                    # First end the previous part
                    self.write_part_end(writeable)
                    prev_part += 1
                    # Now start the new part
                    self.write_part_start(writeable, document_id, prev_part)

            self.write_sentence(writeable, document_id, sentence)

        self.write_part_end(writeable)

        Write sentences to a writeable in CoNLL format.

        Take the specified action when something is missing.

        Enforces `part_number` to be a number and to be increasing.
        Assumes all words in a sentence have the same `part_number`.
        Does not validate any other values.
        
Write sentences to a writeable in CoNLL format.
Take the specified action when something is missing.

Enforces `part_number` to be a number and to be increasing.
Assumes all words in a sentence have the same `part_number`.
Does not validate any other values.
Write sentences to a writeable in CoNLL format . Take the specified action when something is missing . Enforces ` part_number ` to be a number and to be increasing . Assumes all words in a sentence have the same ` part_number ` . Does not validate any other values .
def write(self, writeable, document_id, sentences):
        prev_part = 0
        self.write_part_start(writeable, document_id, prev_part)
        for sentence in sentences:
            current_part = sentence[0].get(
                'part_number',
                None
            ) if sentence else None
            if current_part is None:
                current_part = self.defaults['part_number']
            try:
                current_part = int(current_part)
            except ValueError as e:
                raise ValueError(
                    f"The part number should be a number in : {sentence}"
                ) from e
            if prev_part != current_part:
                if prev_part > current_part:
                    raise ValueError(
                        "The part number should be a increasing in:"
                        f" {sentence}"
                    )
                while prev_part != current_part:
                    self.write_part_end(writeable)
                    prev_part += 1
                    self.write_part_start(writeable, document_id, prev_part)
            self.write_sentence(writeable, document_id, sentence)
        self.write_part_end(writeable)
def write ( self , writeable , document_id , sentences ) : prev_part = 0 self . write_part_start ( writeable , document_id , prev_part ) for sentence in sentences : current_part = sentence [ 0 ] . get ( 'part_number' , None ) if sentence else None if current_part is None : current_part = self . defaults [ 'part_number' ] try : current_part = int ( current_part ) except ValueError as e : raise ValueError ( f"The part number should be a number in : {sentence}" ) from e if prev_part != current_part : if prev_part > current_part : raise ValueError ( "The part number should be a increasing in:" f" {sentence}" ) while prev_part != current_part : self . write_part_end ( writeable ) prev_part += 1 self . write_part_start ( writeable , document_id , prev_part ) self . write_sentence ( writeable , document_id , sentence ) self . write_part_end ( writeable )
Write sentences to a writeable in CoNLL format.
Write sentences to a writeable in CoNLL format .
"""
        Write sentences to a writeable in CoNLL format.

        Take the specified action when something is missing.

        Enforces `part_number` to be a number and to be increasing.
        Assumes all words in a sentence have the same `part_number`.
        Does not validate any other values.
        """ # First end the previous part # Now start the new part
self
writeable
document_id
sentences