code: def __init__(
      self,
      path_to_source: Union[str, Path],
      path_to_target: Union[str, Path],
      max_tokens_per_doc=-1,
      max_chars_per_doc=-1,
      use_tokenizer=True,
      in_memory: bool = True,
  ) -> None:
      path_to_source = Path(path_to_source)
      path_to_target = Path(path_to_target)
  
      assert path_to_source.exists()
      assert path_to_target.exists()
  
      self.in_memory = in_memory
  
      self.use_tokenizer = use_tokenizer
      self.max_tokens_per_doc = max_tokens_per_doc
  
      self.total_sentence_count: int = 0
  
      if self.in_memory:
          self.bi_sentences: List[DataPair] = []
      else:
          self.source_lines: List[str] = []
          self.target_lines: List[str] = []
  
      with open(
          str(path_to_source), encoding="utf-8"
      ) as source_file, open(
          str(path_to_target), encoding="utf-8"
      ) as target_file:
          source_line = source_file.readline()
          target_line = target_file.readline()
  
          while source_line and target_line:
              source_line = source_file.readline()
              target_line = target_file.readline()
  
              if source_line.strip() == "":
                  continue
              if target_line.strip() == "":
                  continue
  
              if max_chars_per_doc > 0:
                  source_line = source_line[:max_chars_per_doc]
                  target_line = target_line[:max_chars_per_doc]
  
              if self.in_memory:
                  bi_sentence = self._make_bi_sentence(
                      source_line, target_line
                  )
                  self.bi_sentences.append(bi_sentence)
              else:
                  self.source_lines.append(source_line)
                  self.target_lines.append(target_line)
  
              self.total_sentence_count += 1
  
imports: import logging
  import os
  from pathlib import Path
  from typing import List, Optional, Union
  import flair
  from flair.data import Corpus, DataPair, FlairDataset, Sentence, TextPair, _iter_dataset
  from flair.datasets.base import find_train_dev_test_files
  from flair.file_utils import cached_path, unpack_file, unzip_file
label_desc: Use image node_id 1 to create a new ParallelTextDataset object from inherited base classes: FlairDataset with example: obj = ParallelTextDataset(path_to_source, path_to_target, max_tokens_per_doc, max_chars_per_doc, use_tokenizer, in_memory)