diff --git a/gptc/compiler.py b/gptc/compiler.py index 5c1c19e..865f719 100755 --- a/gptc/compiler.py +++ b/gptc/compiler.py @@ -42,7 +42,12 @@ def compile(raw_model): except KeyError: word_weights[word] = {category:value} - word_weights['__version__'] = 1 - word_weights['__raw__'] = raw_model + model = {} + for word, weights in word_weights.items(): + total = sum(weights.values()) + model[word] = {category: weight/total for category, weight in weights.items()} - return word_weights + model['__version__'] = 2 + model['__raw__'] = raw_model + + return model