#!/usr/bin/python
# -*- coding: utf-8 -*-
import sys, codecs
from wnp_eval import kbest

def main():
	filename = sys.argv[1]
	outname = sys.argv[2]
	k = 20

	print "Loading kbest file from", filename
	klist = kbest.parse_kbest_txt_file(filename, k, 0)

	print "Writing pairs to", outname
	with codecs.open(outname, 'w', 'utf8') as out:
		for head in sorted(klist):
			for (word,sim) in klist[head]:
				out.write("%s;%s;%f\n" % (head, word, sim) )
	



