Instantly share code, notes, and snippets.

@funktor /transitions.py Secret
Created Oct 14, 2018

Embed
What would you like to do?
from collections import Counter
info = tagger.info()
def print_transitions(trans_features):
for (label_from, label_to), weight in trans_features:
print("%-6s -> %-7s %0.6f" % (label_from, label_to, weight))
print("Top likely transitions:")
print_transitions(Counter(info.transitions).most_common(15))
print("\nTop unlikely transitions:")
print_transitions(Counter(info.transitions).most_common()[-15:])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment