Example #1
0
 public void GivenNullArgument_FromArpabet_ExpectException()
 {
     Assert.ThrowsException <ArgumentNullException>(() =>
     {
         var ipa = EnPronunciation.FromIpa(null);
     });
 }
Example #2
0
 public void GivenInvalidSpaceInArpabet_ExpectException()
 {
     Assert.ThrowsException <ArgumentException>(() =>
     {
         var arpabet = EnPronunciation.FromArpabet(new string[] { "F", "B ", "N", "EH", "T", "IH", "K" });
     });
 }
Example #3
0
        public void GivenIpaFromIpa_ExpectPositiveMatch()
        {
            var ipa = EnPronunciation.FromIpa("ðɪsɪzətɛst");

            Assert.IsTrue(ipa.Phones.Count > 0);
            Assert.AreEqual("ðɪsɪzətɛst", ipa.Ipa);
        }
Example #4
0
        public void GivenIpaFromArpabet_ExpectPositiveMatch()
        {
            var arpabet = EnPronunciation.FromArpabet(new string[] { "dh", "ih1", "s", "ih1", "z", "ax0", "t", "eh1", "s", "t" });

            Assert.IsTrue(arpabet.Phones.Count > 0);
            Assert.AreEqual("ðɪsɪzətɛst", arpabet.Ipa);
        }
Example #5
0
 public void GivenInvalidIpa_FromIpa_ExpectException()
 {
     Assert.ThrowsException <ArgumentException>(() =>
     {
         var ipa = EnPronunciation.FromIpa("This is not an IPA");
     });
 }
Example #6
0
        public void GivenPronunciationFromArpabet_ExpectPositiveMatch()
        {
            var pron = EnPronunciation.FromArpabet(new string[] { "P", "R", "OW0", "N", "AH2", "N", "S", "IY0", "EY1", "SH", "AX0", "N" });

            Assert.IsTrue(pron.Phones.Count > 0);
            Assert.AreEqual("proʊ̯nʌnsieɪ̯ʃən", pron.Ipa);

            // p
            var phone = pron.Phones[0];

            Assert.AreEqual(PhoneType.Consonant, phone.Type);
            Assert.AreEqual(Phonation.Voiceless, phone.Phonation);
            Assert.AreEqual(PlaceOfArticulation.Bilabial, phone.Place);
            Assert.AreEqual(MannerOfArticulation.Plosive, phone.Manner);
            Assert.IsFalse(phone.IsSyllabic);
            Assert.IsNull(phone.Height);
            Assert.IsNull(phone.Backness);
            Assert.IsNull(phone.Roundedness);
            Assert.IsNull(phone.IsRhotic);

            // o
            phone = pron.Phones[2];
            Assert.AreEqual(PhoneType.Vowel, phone.Type);
            Assert.AreEqual(Phonation.Modal, phone.Phonation);
            Assert.AreEqual(VowelHeight.CloseMid, phone.Height);
            Assert.AreEqual(VowelBackness.Back, phone.Backness);
            Assert.AreEqual(VowelRoundedness.Rounded, phone.Roundedness);
            Assert.IsTrue(phone.IsSyllabic);

            // ʊ̯
            phone = pron.Phones[3];
            Assert.AreEqual(PhoneType.Vowel, phone.Type);
            Assert.AreEqual(Phonation.Modal, phone.Phonation);
            Assert.AreEqual(VowelHeight.NearClose, phone.Height);
            Assert.AreEqual(VowelBackness.NearBack, phone.Backness);
            Assert.AreEqual(VowelRoundedness.Rounded, phone.Roundedness);
            Assert.IsFalse(phone.IsSyllabic);
            Assert.IsNull(phone.Place);
            Assert.IsNull(phone.Manner);
        }
Example #7
0
 /// <summary>
 /// Initializes a new instance of the <see cref="DistanceInput"/> class.
 /// </summary>
 /// <param name="phrase">the text to compute distance on</param>
 /// <param name="pronunciation">the pronunciation to compute distance on</param>
 public DistanceInput(string phrase, EnPronunciation pronunciation)
 {
     this.Phrase        = phrase;
     this.Pronunciation = pronunciation;
 }