Beispiel #1
0
 static public string[] DeleteWords(string path, int lenght)
 {
     string[] sentences = Sentence.ReadText(path);
     for (int i = 0; i < sentences.Length; i++)
     {
         string[] words      = Word.Words(sentences[i]);
         string[] puctuation = Punctuation.GetPuctuation(sentences[i]);
         sentences[i] = "";
         for (int j = 0; j < puctuation.Length; j++)
         {
             if (j < words.Length)
             {
                 if (words[j].Length == lenght && Сonstant(words[j][0]))
                 {
                     words[j] = null;
                 }
                 sentences[i] += words[j];
             }
             if (puctuation[j] != null)
             {
                 sentences[i] += puctuation[j];
             }
         }
     }
     return(sentences);
 }
Beispiel #2
0
        static public string[] ChangeWord(string path, int sentece_number, int word_lenght, string changed_word)
        {
            string[] sentences  = Sentence.ReadText(path);
            string[] words      = Word.Words(sentences[sentece_number - 1]);
            string[] puctuation = Punctuation.GetPuctuation(sentences[sentece_number - 1]);
            sentences[sentece_number - 1] = "";
            for (int j = 0; j < puctuation.Length; j++)
            {
                if (puctuation[j] != null)
                {
                    sentences[sentece_number - 1] += puctuation[j];
                }
                if (j < words.Length)
                {
                    if (words[j].Length == word_lenght)
                    {
                        words[j] = changed_word;
                    }
                    sentences[sentece_number - 1] += words[j];
                }
            }

            return(sentences);
        }