import pyplwn, codecs

db = pyplwn.database.Database('root', 'krasnal', 'localhost', 'wordnet_test')
gr = pyplwn.wngraph.WNGraph('hiperonimia', db, False)

i = 1
while (i<11):
	file = codecs.open('test_%s.txt' % (i), 'w')
	line = 0
	for pair in gr.get_words_in_distance(i, 2):
		if line>0: file.write('\n')
		line += 1
		file.write("%s; %s" % pair)
	file.close()
	i += 1