'Persist this model into the passed directory. Returns the metadata necessary to load the model again.'

def persist(self, model_dir):

    if self.known_patterns:
        regex_file = os.path.join(model_dir, u'regex_featurizer.json')
        with io.open(regex_file, u'w') as f:
            f.write(str(json.dumps(self.known_patterns, indent=4)))
        return {u'regex_featurizer': u'regex_featurizer.json'}
    else:
        return {u'regex_featurizer': None}
