<commit_before>import codecs
import json
import os


class RasaNLUConfig(object):

    def __init__(self, filename=None, env_vars=None, cmdline_args=None):

        defaults = {
          "backend": "mitie",
          "config": "config.json",
          "data": None,
          "emulate": None,
          "language": "en",
          "mitie_file": "./data/total_word_feature_extractor.dat",
          "path": "./data",
          "port": 5000,
          "server_model_dir": None,
          "token": None,
          "write": os.path.join(os.getcwd(), "rasa_nlu_log.json")
        }

        self.override(defaults)

        if filename is not None:
            file_config = json.loads(codecs.open(filename, encoding='utf-8').read())
            self.override(file_config)

        if env_vars is not None:
            env_config = self.format_env_vars(env_vars)
            print("env_config : {0}".format(env_config))
            self.override(env_config)

        if cmdline_args is not None:
            print("cmdline_args : {0}".format(cmdline_args))
            self.override(cmdline_args)

        for key, value in self.items():
            setattr(self, key, value)

        self.validate()

    def __getitem__(self, key):
        return self.__dict__[key]<commit_msg>bugfix config defaults<commit_after>import codecs
import json
import os


class RasaNLUConfig(object):

    def __init__(self, filename=None, env_vars=None, cmdline_args=None):

        defaults = {
          "backend": "mitie",
          "config": "config.json",
          "data": None,
          "emulate": None,
          "language": "en",
          "mitie_file": "./data/total_word_feature_extractor.dat",
          "path": os.getcwd(),
          "port": 5000,
          "server_model_dir": None,
          "token": None,
          "write": os.path.join(os.getcwd(), "rasa_nlu_log.json")
        }

        self.override(defaults)

        if filename is not None:
            file_config = json.loads(codecs.open(filename, encoding='utf-8').read())
            self.override(file_config)

        if env_vars is not None:
            env_config = self.format_env_vars(env_vars)
            print("env_config : {0}".format(env_config))
            self.override(env_config)

        if cmdline_args is not None:
            print("cmdline_args : {0}".format(cmdline_args))
            self.override(cmdline_args)

        for key, value in self.items():
            setattr(self, key, value)

        self.validate()

    def __getitem__(self, key):
        return self.__dict__[key]
{'fraction_non_alphanumeric': 0.12607338017174083, 'fraction_numerical': 0.00546448087431694, 'mean_word_length': 2.1409313725490198, 'pattern_counts': {'":': 22, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6762483', 'n_tokens_mistral': 802, 'n_tokens_neox': 775, 'n_words': 159}