class_docstr: Parse BCP-47 composite language tags
  
  Supports all the main subtags, and the 'u-sd' extension:
  
  >>> from nltk.corpus import bcp47
  >>> bcp47.name('oc-gascon-u-sd-fr64')
  'Occitan (post 1500): Gascon: Pyrénées-Atlantiques'
  
  Can load a conversion table to Wikidata Q-codes:
  >>> bcp47.load_wiki_q()
  >>> bcp47.wiki_q['en-GI-spanglis']
  'Q79388'
docstr: Convert the BCP-47 language subtag registry to a dictionary
docstr_tok: ["Convert","the","BCP-47","language","subtag","registry","to","a","dictionary"]
code: def data_dict(self, records):
      """Convert the BCP-47 language subtag registry to a dictionary"""
      self.version = records[0].replace("File-Date:", "").strip()
      dic = {}
      dic["deprecated"] = {}
      for label in [
          "language",
          "extlang",
          "script",
          "region",
          "variant",
          "redundant",
          "grandfathered",
      ]:
          dic["deprecated"][label] = {}
      for record in records[1:]:
          fields = [
              field.split(": ") for field in record.strip().split("\n")
          ]
          typ = fields[0][1]
          tag = fields[1][1]
          if typ not in dic:
              dic[typ] = {}
          subfields = {}
          for field in fields[2:]:
              if len(field) == 2:
                  [key, val] = field
                  if key not in subfields:
                      subfields[key] = [val]
                  else:  # multiple value
                      subfields[key].append(val)
              else:  # multiline field
                  subfields[key][-1] += " " + field[0].strip()
              if (
                  "Deprecated" not in record
                  and typ == "language"
                  and key == "Description"
              ):
                  self.langcode[subfields[key][-1]] = tag
          for key in subfields:
              if len(subfields[key]) == 1:  # single value
                  subfields[key] = subfields[key][0]
          if "Deprecated" in record:
              dic["deprecated"][typ][tag] = subfields
          else:
              dic[typ][tag] = subfields
      return dic
  
file_path: nltk/nltk/corpus/reader/bcp47.py
imports: import re
  from warnings import warn
  from xml.etree import ElementTree
  from nltk.corpus.reader import CorpusReader
label_desc: Use image node_id 6 for calling the BCP47CorpusReader obj's underlying member method code with example usage: obj.data_dict(records) and returns: dic