class_docstr: DatasetBuilder for wikiann dataset.
class_docstr_tok: ["DatasetBuilder","for","wikiann","dataset","."]
docstr: Reads line by line format of the NER dataset and generates examples.
  
  Input Format:
  
  en:rick  B-PER
  en:and  O
  en:morty  B-PER
  en:are  O
  en:cool  O
  en:.  O
  
  Output Format:
  
  {
  'tokens': ["rick", "and", "morty", "are", "cool", "."],
  'tags': ["B-PER", "O" , "B-PER", "O", "O", "O"],
  'langs': ["en", "en", "en", "en", "en", "en"]
  'spans': ["PER: rick", "PER: morty"]
  }
  
  Args:
    filepath: Path to file with line by line NER format.
  
  Yields:
    Examples with the format listed above.
docstr_tok: ["Reads","line","by","line","format","of","the","NER","dataset","and","generates","examples",".","Input","Format",":","en",":","rick","B-PER","en",":","and","O","en",":","morty","B-PER","en",":","are","O","en",":","cool","O","en",":",".","O","Output","Format",":","{","'tokens","'",":","[","``","rick","''",",","``","and","''",",","``","morty","''",",","``","are","''",",","``","cool","''",",","``",".","``","]",",","'tags","'",":","[","``","B-PER","''",",","``","O","''",",","``","B-PER","''",",","``","O","''",",","``","O","''",",","``","O","''","]",",","'langs","'",":","[","``","en","''",",","``","en","''",",","``","en","''",",","``","en","''",",","``","en","''",",","``","en","''","]","'spans","'",":","[","``","PER",":","rick","''",",","``","PER",":","morty","''","]","}","Args",":","filepath",":","Path","to","file","with","line","by","line","NER","format",".","Yields",":","Examples","with","the","format","listed","above","."]
code: def _generate_examples(self, filepath):
      """Reads line by line format of the NER dataset and generates examples.
  
      Input Format:
  
      en:rick  B-PER
      en:and  O
      en:morty  B-PER
      en:are  O
      en:cool  O
      en:.  O
  
      Output Format:
  
      {
      'tokens': ["rick", "and", "morty", "are", "cool", "."],
      'tags': ["B-PER", "O" , "B-PER", "O", "O", "O"],
      'langs': ["en", "en", "en", "en", "en", "en"]
      'spans': ["PER: rick", "PER: morty"]
      }
  
      Args:
        filepath: Path to file with line by line NER format.
  
      Yields:
        Examples with the format listed above.
      """
  
      key = 1
      with tf.io.gfile.GFile(filepath, "r") as f:
          tokens = []
          tags = []
          langs = []
          for line in f:
              line = line.rstrip()
              # pylint: disable=g-explicit-bool-comparison
              if line.startswith("-DOCSTART-") or line == "":
                  if tokens:
                      spans = get_spans(tokens, tags)
                      yield key, {
                          "tokens": tokens,
                          "tags": tags,
                          "langs": langs,
                          "spans": spans,
                      }
                      key += 1
                      tokens = []
                      tags = []
                      langs = []
              else:
                  # wikiann data is tab separated
                  fields = line.split("\t")
                  # strip out language prefix
                  langs.append(fields[0].split(":")[0])
                  tokens.append(":".join(fields[0].split(":")[1:]))
                  if len(fields) > 1:
                      tags.append(fields[-1])
                  else:
                      # examples have no label in test set
                      tags.append("O")
          if tokens:
              spans = get_spans(tokens, tags)
              yield key, {
                  "tokens": tokens,
                  "tags": tags,
                  "langs": langs,
                  "spans": spans,
              }
  
file_path: datasets/tensorflow_datasets/text/wikiann/wikiann.py
imports: import os
  from tensorflow_datasets.core.utils.lazy_imports_utils import tensorflow
  import tensorflow_datasets.public_api
label_desc: Use image node_id 3 for calling the Wikiann obj's underlying member method code with example usage: obj._generate_examples(filepath) without return types