# Path: chatbot/hparams.py
# class HParams:
#     def __init__(self, model_dir):
#         """
#         Args:
#             model_dir: Name of the folder storing the hparams.json file.
#         """
#         self.hparams = self.load_hparams(model_dir)
# 
#     @staticmethod
#     def load_hparams(model_dir):
#         """Load hparams from an existing directory."""
#         hparams_file = os.path.join(model_dir, "hparams.json")
#         if tf.gfile.Exists(hparams_file):
#             print("# Loading hparams from {} ...".format(hparams_file))
#             with codecs.getreader("utf-8")(tf.gfile.GFile(hparams_file, "rb")) as f:
#                 try:
#                     hparams_values = json.load(f)
#                     hparams = tf.contrib.training.HParams(**hparams_values)
#                 except ValueError:
#                     print("Error loading hparams file.")
#                     return None
#             return hparams
#         else:
#             return None


import codecs
import os
import tensorflow as tf
from collections import namedtuple
from tensorflow.python.ops import lookup_ops
from chatbot.hparams import HParams
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# ==============================================================================



COMMENT_LINE_STT = "#=="
CONVERSATION_SEP = "==="

AUG0_FOLDER = "Augment0"
AUG1_FOLDER = "Augment1"
AUG2_FOLDER = "Augment2"

MAX_LEN = 1000  # Assume no line in the training data is having more than this number of characters
VOCAB_FILE = "vocab.txt"


class TokenizedData:
    def __init__(self, corpus_dir, hparams=None, training=True, buffer_size=8192):
        """
        Args:
            corpus_dir: Name of the folder storing corpus files for training.
            hparams: The object containing the loaded hyper parameters. If None, it will be 
                    initialized here.
            training: Whether to use this object for training.
            buffer_size: The buffer size used for mapping process during data processing.
        """
        if hparams is None:

# Path: chatbot/hparams.py
# class HParams:
#     def __init__(self, model_dir):
#         """
#         Args:
#             model_dir: Name of the folder storing the hparams.json file.
#         """
#         self.hparams = self.load_hparams(model_dir)
# 
#     @staticmethod
#     def load_hparams(model_dir):
#         """Load hparams from an existing directory."""
#         hparams_file = os.path.join(model_dir, "hparams.json")
#         if tf.gfile.Exists(hparams_file):
#             print("# Loading hparams from {} ...".format(hparams_file))
#             with codecs.getreader("utf-8")(tf.gfile.GFile(hparams_file, "rb")) as f:
#                 try:
#                     hparams_values = json.load(f)
#                     hparams = tf.contrib.training.HParams(**hparams_values)
#                 except ValueError:
#                     print("Error loading hparams file.")
#                     return None
#             return hparams
#         else:
#             return None


# Path: chatbot/tokenizeddata.py
import codecs
import os
import tensorflow as tf
from collections import namedtuple
from tensorflow.python.ops import lookup_ops
from chatbot.hparams import HParams

# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# ==============================================================================



COMMENT_LINE_STT = "#=="
CONVERSATION_SEP = "==="

AUG0_FOLDER = "Augment0"
AUG1_FOLDER = "Augment1"
AUG2_FOLDER = "Augment2"

MAX_LEN = 1000  # Assume no line in the training data is having more than this number of characters
VOCAB_FILE = "vocab.txt"


class TokenizedData:
    def __init__(self, corpus_dir, hparams=None, training=True, buffer_size=8192):
        """
        Args:
            corpus_dir: Name of the folder storing corpus files for training.
            hparams: The object containing the loaded hyper parameters. If None, it will be 
                    initialized here.
            training: Whether to use this object for training.
            buffer_size: The buffer size used for mapping process during data processing.
        """
        if hparams is None:

            self.hparams = HParams(corpus_dir).hparams