def import_dicts():
	data = []
	with open('DICTLINE.GEN', encoding="ISO-8859-1") as f:
		for i, line in enumerate( f ):

			orth = line[0:19].replace("zzz", "").strip()
			parts = [orth]

			if len( line[19:38].strip() ) > 0:
				parts.append( line[19:38].replace("zzz", "").strip() )

			if len( line[38:57].strip() ) > 0:
				parts.append( line[38:57].replace("zzz", "").strip() )

			if len( line[57:76].strip() ) > 0:
				parts.append( line[57:76].replace("zzz", "").strip() )

			if len( line[83:87].strip() ) > 0:
				n = line[83:87].strip().split(" ")
				for n_i, v in enumerate(n):
					try: 
						n[n_i] = int(v)
					except __HOLE__:
						pass

			senses = line[109:].strip().split(";")
			new_senses = []
			for sense in senses:
				sense = sense.strip()
				if len( sense ):
					new_senses.append(sense)


			data.append({
				'id' : i + 1,
				'orth' : orth, 
				'parts' : parts, 
				'pos' : line[76:83].strip(),
				'form' : line[83:100].strip(),
				'n' : n,
				'senses' : new_senses 
				})

	with open('data.json', 'w') as out:
	    json.dump(data, out)

	return
dataset/ETHPy150Open segetes/open_words/open_words/format_data.py/import_dicts