Ejemplo n.º 1
0
        public void Rules_JShumn()
        {
            string word   = "бойкий";
            string result = Syllables.Rules(word);

            Assert.AreEqual("бой-кий", result);
        }
Ejemplo n.º 2
0
        public void Rules_DoubleShumn()
        {
            string word   = "такса";
            string result = Syllables.Rules(word);

            Assert.AreEqual("та-кса", result);
        }
Ejemplo n.º 3
0
        public void Rules_GlasnSonornGlasn()
        {
            string word   = "око";
            string result = Syllables.Rules(word);

            Assert.AreEqual("о-ко", result);
        }
Ejemplo n.º 4
0
        public void Rules_ShumnAfterGlasn()
        {
            string word   = "роса";
            string result = Syllables.Rules(word);

            Assert.AreEqual("ро-са", result);
        }
Ejemplo n.º 5
0
        public void Rules_DoubleLetter()
        {
            string word   = "масса";
            string result = Syllables.Rules(word);

            Assert.AreEqual("ма-сса", result);
        }
Ejemplo n.º 6
0
        public void Rules_SonornAfterJ()
        {
            string word   = "стойло";
            string result = Syllables.Rules(word);

            Assert.AreEqual("стой-ло", result);
        }
Ejemplo n.º 7
0
        public void Rules_OneSlog()
        {
            string word   = "слог";
            string result = Syllables.Rules(word);

            Assert.AreEqual("слог", result);
        }
Ejemplo n.º 8
0
        public void Rules_GlasnAfterGlasn()
        {
            string word   = "диалог";
            string result = Syllables.Rules(word);

            Assert.AreEqual("ди-а-лог", result);
        }
Ejemplo n.º 9
0
        public void Rules_SonornSonorn()
        {
            string word   = "полный";
            string result = Syllables.Rules(word);

            Assert.AreEqual("по-лный", result);
        }
Ejemplo n.º 10
0
        public void Rules_UnknownSymbol_NorLetterNorHyphren()
        {
            string word   = "сло8о";
            string result = Syllables.Rules(word);

            Assert.AreEqual("сло8-о", result);
        }
Ejemplo n.º 11
0
        public void Rules_ContainsHyphren_NoGlasn()
        {
            string word   = "зачем-то";
            string result = Syllables.Rules(word);

            Assert.AreEqual("за-чем-то", result);
        }
Ejemplo n.º 12
0
        public void Rules_GlasnShumnSonorn()
        {
            string word   = "весна";
            string result = Syllables.Rules(word);

            Assert.AreEqual("ве-сна", result);
        }
Ejemplo n.º 13
0
        public void Rules_UnknownSymbol_Sonorn()
        {
            string word   = "слмъово";
            string result = Syllables.Rules(word);

            Assert.AreEqual("слмъо-во", result);
        }
Ejemplo n.º 14
0
        public void Rules_UnknownSymbol_NoSonorn()
        {
            string word   = "вьюга";
            string result = Syllables.Rules(word);

            Assert.AreEqual("вью-га", result);
        }
Ejemplo n.º 15
0
        public void Divide_SeveralWords()
        {
            string word   = "слог слово";
            string result = Syllables.DivideText(word);

            Assert.AreEqual("слог сло-во ", result);
        }
Ejemplo n.º 16
0
        public void Rules_ContainsHyphren_GlasnSlog()
        {
            string word   = "как-то";
            string result = Syllables.Rules(word);

            Assert.AreEqual("как-то", result);
        }
Ejemplo n.º 17
0
        public void PrintSlog_firstPrintedfalse_cut0()
        {
            string        result       = "";
            StringBuilder slog         = new StringBuilder("тест");
            bool          firstPrinted = false;

            slog = Syllables.PrintSlog(slog, ref result, ref firstPrinted);
            Assert.AreEqual("", slog.ToString());
            Assert.AreEqual("тест", result);
        }
 public LookupWordViewModel(string word, Syllables syllables, Pronunciation pronunciation)
 {
     _wordDisplay = word;
     if (syllables?.List?.Length > 0)
     {
         foreach (var syllable in syllables.List)
         {
             _syllableDisplay += syllable + "·";
         }
         _syllableDisplay = _syllableDisplay[0..^ 1];
Ejemplo n.º 19
0
        public void PrintSlog_firstPrintedtrue_cut2()
        {
            string        result       = "";
            StringBuilder slog         = new StringBuilder("тест");
            bool          firstPrinted = true;

            slog = Syllables.PrintSlog(slog, ref result, ref firstPrinted, 2);
            Assert.AreEqual("ст", slog.ToString());
            Assert.AreEqual("-те", result);
        }
Ejemplo n.º 20
0
        public string getSpellingText(string text)
        {
            SyllableLibrary syllble = new SyllableLibrary();
            Syllables       ss      = syllble.GetSyllableWords(text);
            string          newText = "";

            foreach (var hece in ss)
            {
                if (newText.Equals(""))
                {
                    newText = hece.Value;
                }
                else
                {
                    newText += "-" + hece.Value;
                }
            }
            return(newText);
        }
Ejemplo n.º 21
0
 static void Main(string[] args)
 {
     SyllableLibrary syllble = new SyllableLibrary();
     Syllables       ss      = syllble.GetSyllableWords("şebinkarahisarlılar");
 }
 public int TotalVowels()
 {
     return(Syllables.Sum(each => each.CountPhonemeVowels()));
 }
        public Syllables GetSyllableWords(string word)
        {
            Syllables result   = new Syllables();
            Syllable  tempWord = new Syllable();


            word = word.ToLower().Trim();
            bool lastWasVowel = false;
            var  vowels       = new[] { 'a', 'e', 'i', 'ı', 'o', 'ö', 'u', 'ü' };

            tempWord.Value = "";


            string     tempSyllable = "";
            List <int> wordPosition = new List <int>();

            for (int i = 0; i < word.Length; i++)
            {
                char tempKey = word[i];
                if (vowels.Contains(tempKey))
                {
                    tempSyllable = "";
                }
                else
                {
                    tempSyllable += tempKey;
                    if (tempSyllable.Length > 1)
                    {
                        wordPosition.Add(i - 1);
                    }
                }
            }
            wordPosition.Add(word.Length - 1);


            for (var i = 0; i < wordPosition.Count; i++)
            {
                string innerWord = word.Substring(
                    i == 0 ? 0 : wordPosition[i - 1] + 1,
                    i == 0 ? wordPosition[i] + 1 : wordPosition[i] - wordPosition[i - 1]);


                tempWord = new Syllable();
                foreach (var c in innerWord)
                {
                    tempWord.Value += c;

                    if (vowels.Contains(c))
                    {
                        if (!lastWasVowel)
                        {
                            result.Add(tempWord);
                            tempWord = new Syllable();
                        }

                        lastWasVowel = true;
                    }
                    else
                    {
                        lastWasVowel = false;
                    }
                }

                if (tempWord?.Value?.Length > 0)
                {
                    try
                    {
                        result.Last().Value += tempWord.Value;
                    } catch (Exception ex)
                    {
                        Console.WriteLine(ex.Message);
                    }
                }
            }


            return(result);
        }
Ejemplo n.º 24
0
 public void TestPronunciation()
 {
     PronunciationEngine.GetPhoneticsWord("fish").Should().NotBeNull();
     PronunciationEngine.GetPhoneticsWord("fish") !.Syllables.Should().NotBeEmpty();
 }
Ejemplo n.º 25
0
 public Lyrics(SyllableType type, string text, double?defaultY)
 {
     Syllables.Add(new Syllable(type, text));
     defaultYPosition = defaultY;
 }
Ejemplo n.º 26
0
        public override string ToString()
        {
            var symbols = string.Join(".", Syllables.Select(s => string.Join("", s.Phonemes.Select(p => p.Symbol))));

            return($"/{symbols}/");
        }