class_docstr: Class to read training datasets in CoNLL-2003 format
class_docstr_tok: ["Class","to","read","training","datasets","in","CoNLL-2003","format"]
code: def parse_ner_file(self, file_name: Path):
      samples = []
      with file_name.open(encoding="utf8") as f:
          tokens = []
          pos_tags = []
          chunk_tags = []
          tags = []
          expected_items = (
              2 + int(self.provide_pos) + int(self.provide_chunk)
          )
          for line in f:
              # Check end of the document
              if "DOCSTART" in line:
                  if len(tokens) > 1:
                      x = tokens if not self.x_is_tuple else (tokens,)
                      if self.provide_pos:
                          x = x + (pos_tags,)
                      if self.provide_chunk:
                          x = x + (chunk_tags,)
                      if self.provide_doc_ids:
                          x = x + (self.num_docs,)
                      samples.append((x, tags))
                      tokens = []
                      pos_tags = []
                      chunk_tags = []
                      tags = []
                  self.num_docs += 1
                  if self.docstart_token is not None:
                      tokens = [self.docstart_token]
                      pos_tags = ["O"]
                      chunk_tags = ["O"]
                      tags = ["O"]
              elif len(line) < 2:
                  if (len(tokens) > 0) and (
                      tokens != [self.docstart_token]
                  ):
                      x = tokens if not self.x_is_tuple else (tokens,)
                      if self.provide_pos:
                          x = x + (pos_tags,)
                      if self.provide_chunk:
                          x = x + (chunk_tags,)
                      if self.provide_doc_ids:
                          x = x + (self.num_docs,)
                      samples.append((x, tags))
                      tokens = []
                      pos_tags = []
                      chunk_tags = []
                      tags = []
              else:
                  items = line.split()
                  if len(items) < expected_items:
                      raise Exception(f"Input is not valid {line}")
                  tokens.append(items[0])
                  tags.append(items[-1])
                  if self.provide_pos:
                      pos_tags.append(items[1])
                  if self.provide_chunk:
                      chunk_tags.append(items[2])
          if tokens:
              x = tokens if not self.x_is_tuple else (tokens,)
              if self.provide_pos:
                  x = x + (pos_tags,)
              if self.provide_chunk:
                  x = x + (chunk_tags,)
              if self.provide_doc_ids:
                  x = x + (self.num_docs,)
              samples.append((x, tags))
              self.num_docs += 1
  
          if self.iob:
              return [
                  (x, self._iob2_to_iob(tags)) for x, tags in samples
              ]
          if self.iobes:
              return [
                  (x, self._iob2_to_iobes(tags)) for x, tags in samples
              ]
  
      return samples
  
file_path: DeepPavlov/deeppavlov/dataset_readers/conll2003_reader.py
imports: from logging import getLogger
  from pathlib import Path
  from deeppavlov.core.common.registry import register
  from deeppavlov.core.data.dataset_reader import DatasetReader
  from deeppavlov.core.data.utils import download_decompress
label_desc: Use image node_id 2 for calling the Conll2003DatasetReader obj's underlying member method code with example usage: obj.parse_ner_file(file_name) and returns: samples, unknown, unknown