docstr: Instantiates a Corpus from a OCR-Json format.
  
  :param train_path: the folder for the training data
  :param dev_path: the folder for the dev data
  :param test_path: the folder for the test data
  :param path_to_split_directory: base folder with the task data
  :param label_type: the label_type to add the ocr labels to
  :param encoding: the encoding to load the .json files with
  :param load_images: if True, the pillow images will be added as metadata
  :param normalize_coords_to_thousands: if True, the coordinates will be ranged from 0 to 1000
  :param in_memory: If set to True, the dataset is kept in memory as Sentence objects, otherwise does disk reads
  :param label_name_map: Optionally map tag names to different schema.
  :return: a Corpus with Sentences that contain OCR information
docstr_tok: ["Instantiates","a","Corpus","from","a","OCR-Json","format",".",":","param","train_path",":","the","folder","for","the","training","data",":","param","dev_path",":","the","folder","for","the","dev","data",":","param","test_path",":","the","folder","for","the","test","data",":","param","path_to_split_directory",":","base","folder","with","the","task","data",":","param","label_type",":","the","label_type","to","add","the","ocr","labels","to",":","param","encoding",":","the","encoding","to","load","the",".json","files","with",":","param","load_images",":","if","True",",","the","pillow","images","will","be","added","as","metadata",":","param","normalize_coords_to_thousands",":","if","True",",","the","coordinates","will","be","ranged","from","0","to","1000",":","param","in_memory",":","If","set","to","True",",","the","dataset","is","kept","in","memory","as","Sentence","objects",",","otherwise","does","disk","reads",":","param","label_name_map",":","Optionally","map","tag","names","to","different","schema",".",":","return",":","a","Corpus","with","Sentences","that","contain","OCR","information"]
code: def __init__(
      self,
      train_path: Optional[Path] = None,
      dev_path: Optional[Path] = None,
      test_path: Optional[Path] = None,
      encoding: str = "utf-8",
      label_type: str = "ner",
      in_memory: bool = True,
      load_images: bool = False,
      normalize_coords_to_thousands: bool = True,
      label_name_map: Optional[Dict[str, str]] = None,
      **corpusargs,
  ) -> None:
      """Instantiates a Corpus from a OCR-Json format.
  
      :param train_path: the folder for the training data
      :param dev_path: the folder for the dev data
      :param test_path: the folder for the test data
      :param path_to_split_directory: base folder with the task data
      :param label_type: the label_type to add the ocr labels to
      :param encoding: the encoding to load the .json files with
      :param load_images: if True, the pillow images will be added as metadata
      :param normalize_coords_to_thousands: if True, the coordinates will be ranged from 0 to 1000
      :param in_memory: If set to True, the dataset is kept in memory as Sentence objects, otherwise does disk reads
      :param label_name_map: Optionally map tag names to different schema.
      :return: a Corpus with Sentences that contain OCR information
      """
      train: Optional[Dataset] = (
          OcrJsonDataset(
              train_path,
              label_type=label_type,
              encoding=encoding,
              in_memory=in_memory,
              load_images=load_images,
              normalize_coords_to_thousands=normalize_coords_to_thousands,
              label_name_map=label_name_map,
          )
          if train_path is not None
          else None
      )
  
      # read in dev file if exists
      dev: Optional[Dataset] = (
          OcrJsonDataset(
              dev_path,
              label_type=label_type,
              encoding=encoding,
              in_memory=in_memory,
              load_images=load_images,
              normalize_coords_to_thousands=normalize_coords_to_thousands,
              label_name_map=label_name_map,
          )
          if dev_path is not None
          else None
      )
  
      # read in test file if exists
      test: Optional[Dataset] = (
          OcrJsonDataset(
              test_path,
              label_type=label_type,
              encoding=encoding,
              in_memory=in_memory,
              load_images=load_images,
              normalize_coords_to_thousands=normalize_coords_to_thousands,
              label_name_map=label_name_map,
          )
          if test_path is not None
          else None
      )
  
      super().__init__(train, dev, test, **corpusargs)
  
imports: import json
  from pathlib import Path
  from typing import Dict, Optional, Union
  import gdown.download_folder
  import PIL
  from torch.utils.data import Dataset
  import flair
  from flair.data import BoundingBox, Corpus, FlairDataset, Sentence, get_spans_from_bio
  from flair.datasets.base import find_train_dev_test_files
label_desc: Use image node_id 1 to create a new OcrCorpus object from inherited base classes: Corpus with example: obj = OcrCorpus(train_path, dev_path, test_path, encoding, label_type, in_memory, load_images, normalize_coords_to_thousands, label_name_map)