(filepath)
| 38 | |
| 39 | |
| 40 | def get_map_func(filepath): |
| 41 | file = open(filepath) |
| 42 | category_map = json.load(file) |
| 43 | category_mapper = dict(zip(category_map["cats_strings"], category_map["cats_int64s"])) |
| 44 | default_int64 = category_map["default_int64"] |
| 45 | func = lambda s: category_mapper.get(s, default_int64) |
| 46 | return np.vectorize(func) |
| 47 | |
| 48 | |
| 49 | def get_inputs(context, query): |
no test coverage detected