/// <summary> /// takes a lyric and splits it into its onset/nucleus/coda parts /// returns a VCCV_English_Syllable of [null, null, null] if not recognized /// </summary> /// <param name="lyric"></param> /// <returns></returns> public static VCCV_English_Syllable SplitSyllable(string lyric) { var matches = Syllable_RE.Match(lyric).Groups; var result = new VCCV_English_Syllable(); if (matches.Count < 3) { // not recognized result.Onset = null; result.Nucleus = null; result.Coda = null; return(new VCCV_English_Syllable((string)null, null, null)); } result.Onset.Add(matches[1].Value); result.Nucleus.Add(matches[2].Value); result.Coda.Add(matches[3].Value); //TODO: recognize multiple ending sounds // otherwise, return as expected return(result); }
/// <summary> /// takes a lyric and splits it into its onset/nucleus/coda parts /// returns a CVVC_English_Syllable of [null, null, null] if not recognized /// </summary> /// <param name="lyric"></param> /// <returns></returns> public static CVVC_English_Syllable SplitSyllable(string lyric) { var matches = Syllable_RE.Match(lyric).Groups; var result = new CVVC_English_Syllable(); if (matches.Count < 3) { // not recognized result.Onset = null; result.Nucleus = null; result.Coda = null; return(new CVVC_English_Syllable((string)null, null, null)); } result.Onset = matches[1].Value; result.Nucleus = matches[2].Value; result.Coda = matches[3].Value; // otherwise, return as expected return(result); }