import csv


def load_data(dataset_path):
	"""
	Extracts the relevant data from the dataset given.
	Returns {lang: {gloss: [transcription,]}}.
	
	Asserts that there are no entries with unknown or no transcriptions.
	"""
	data = {}  # lang: {gloss: [transcription,]}
	
	with open(dataset_path) as f:
		reader = csv.reader(f, delimiter='\t')
		next(reader)
		for line in reader:
			if line[0] not in data:
				data[line[0]] = {}
			if line[3] not in data[line[0]]:
				data[line[0]][line[3]]  = []
			assert line[5] not in ('', 'XXX')
			data[line[0]][line[3]].append(line[5])
	
	return data