# Path: px/environments/bidaf.py
# class BidafEnvironment(object):
#   def __init__(self,
#                data_dir,
#                shared_path,
#                model_dir,
#                docid_separator='###',
#                debug_mode=False,
#                load_test=False,
#                load_impossible_questions=False):
#   def _ReadImpossiblities(self, dataset, data_dir):
#   def _WordTokenize(self, text):
#   def _PreprocessQaData(self, questions, document_ids):
#   def IsImpossible(self, document_id):
#   def GetAnswers(self, questions, document_ids):


from concurrent import futures
from absl import app
from absl import flags
from absl import logging
from px.environments import bidaf
from px.proto import aqa_pb2
from px.proto import aqa_pb2_grpc
import time
import grpc
    """"Constructor for the BiDAF server."""
    data_dir = kwargs.pop('squad_data_dir', None)
    shared_file = kwargs.pop('bidaf_shared_file', None)
    model_dir = kwargs.pop('bidaf_model_dir', None)
    load_test = kwargs.pop('load_test', False)
    load_impossible_questions = kwargs.pop('load_impossible_questions', False)
    debug_mode = kwargs.pop('debug_mode', False)
    self.debug_mode = debug_mode
    self._InitializeEnvironment(
        data_dir=data_dir,
        shared_file=shared_file,
        model_dir=model_dir,
        load_test=load_test,
        load_impossible_questions=load_impossible_questions,
        debug_mode=debug_mode)

  def _InitializeEnvironment(self, data_dir, shared_file, model_dir, load_test,
                             load_impossible_questions, debug_mode):
    """Initilizes the BiDAF model environment.

    Args:
      data_dir: Directory containing preprocessed SQuAD data.
      shared_file: Path to shared data generated at training time.
      model_dir: Directory contining parameters of a pre-trained BiDAF
                 model.
      load_test: Whether the test set should be loaded as well.
      load_impossible_questions: Whether info about impossibility of questions
                                 should be loaded.
      debug_mode: Whether to log debug information.
    """

# Path: px/environments/bidaf.py
# class BidafEnvironment(object):
#   def __init__(self,
#                data_dir,
#                shared_path,
#                model_dir,
#                docid_separator='###',
#                debug_mode=False,
#                load_test=False,
#                load_impossible_questions=False):
#   def _ReadImpossiblities(self, dataset, data_dir):
#   def _WordTokenize(self, text):
#   def _PreprocessQaData(self, questions, document_ids):
#   def IsImpossible(self, document_id):
#   def GetAnswers(self, questions, document_ids):


# Path: px/environments/bidaf_server.py
from concurrent import futures
from absl import app
from absl import flags
from absl import logging
from px.environments import bidaf
from px.proto import aqa_pb2
from px.proto import aqa_pb2_grpc
import time
import grpc

    """"Constructor for the BiDAF server."""
    data_dir = kwargs.pop('squad_data_dir', None)
    shared_file = kwargs.pop('bidaf_shared_file', None)
    model_dir = kwargs.pop('bidaf_model_dir', None)
    load_test = kwargs.pop('load_test', False)
    load_impossible_questions = kwargs.pop('load_impossible_questions', False)
    debug_mode = kwargs.pop('debug_mode', False)
    self.debug_mode = debug_mode
    self._InitializeEnvironment(
        data_dir=data_dir,
        shared_file=shared_file,
        model_dir=model_dir,
        load_test=load_test,
        load_impossible_questions=load_impossible_questions,
        debug_mode=debug_mode)

  def _InitializeEnvironment(self, data_dir, shared_file, model_dir, load_test,
                             load_impossible_questions, debug_mode):
    """Initilizes the BiDAF model environment.

    Args:
      data_dir: Directory containing preprocessed SQuAD data.
      shared_file: Path to shared data generated at training time.
      model_dir: Directory contining parameters of a pre-trained BiDAF
                 model.
      load_test: Whether the test set should be loaded as well.
      load_impossible_questions: Whether info about impossibility of questions
                                 should be loaded.
      debug_mode: Whether to log debug information.
    """

    self._environment = bidaf.BidafEnvironment(