Skip to content

Instantly share code, notes, and snippets.

@jtauber
Created October 29, 2015 07:55
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 jtauber/16631ec63e6657f9a423 to your computer and use it in GitHub Desktop.
Save jtauber/16631ec63e6657f9a423 to your computer and use it in GitHub Desktop.
#!/usr/bin/env python3
from collections import defaultdict
from math import log
import sys
depths_by_target = defaultdict(list)
with open(sys.argv[1]) as f:
for line in f:
bcvw, text, sword = line.strip().split()
target = bcvw[:5]
item = sword
depth = len(item.split("-"))
depths_by_target[target].append(depth)
for target, depths in depths_by_target.items():
print(int(1000 * sum(depths) / len(depths)), target)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment