# -*- coding: utf-8 -*-
import sys
from gmisclib import g2_select
sys.path.insert(0, 'lib')
import get_phones
import prep_p_fromtext_UNISYN

def selected(info):
	return True


def select_datalist(data):
	return g2_select.filterlist("'fragments' in d", data)


class find_manual_segmentations(get_phones.find_manual_segmentations_from_name):
	def __init__(self, manDBlist):
		get_phones.find_manual_segmentations_from_name.__init__(self, manDBlist, man_seg_key='man_lab')
		

def get_VY_transcription(info):
	return get_phones.get_IViE_transcription(info)


def prepare_VY_phones(info, pmap, phonology):
	return prep_p_fromtext_UNISYN.prepare_phones(info, pmap, phonology, get_VY_transcription)


def prepare_Vy_phones(info, pmap, phonology, find_manual_segmentation):
	candidate_files = find_manual_segmentation(info)
	return prep_p_fromtext_UNISYN.prepare_phones(info, pmap, phonology, candidate_files)


def read_VY(mdfn):
	return get_phones.read_IViE_VY(mdfn)
