Skip to content

Instantly share code, notes, and snippets.

@funktor
Created October 14, 2018 15:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save funktor/7798388f6dfdba23e0bede6389311f83 to your computer and use it in GitHub Desktop.
Save funktor/7798388f6dfdba23e0bede6389311f83 to your computer and use it in GitHub Desktop.
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