03-order_by_perp.py 312 Bytes
from tinydb import TinyDB
import sys 
def getKey(x):
    return x["asr"]

db = TinyDB(sys.argv[1])
out_dir=sys.argv[2]
sorted_model = sorted(db.all(),key=getKey,reverse=True)
with open("{}/ordered_model.txt".format(out_dir),"w") as out_file:
    for model in sorted_model:
        print >>out_file,model["name"]