예제 #1
0
        public bool TranslateSentence(ref string sentence, bool force = false)
        {
            bool result = force || CanTranslateSentence(sentence);

            if (result)
            {
                sentence = Sentences[sentence]();
            }
            else
            {
                List <string> words = sentence.GetWords().ToList();

                result = CanTranslateWords(words);

                if (result)
                {
                    List <string> translatedWords = new List <string>(words);

                    TranslateWords(translatedWords, true);


                    StringBuilder translatedSentence = new StringBuilder(sentence);

                    words.ForEach((w, i) => translatedSentence.Replace(w, translatedWords[i]));

                    sentence = translatedSentence.ToString();
                }
            }

            return(result);
        }
예제 #2
0
파일: Text.cs 프로젝트: JillyMan/DOT_NET
        public override string ToString()
        {
            string result = "";

            Sentences.ToList().ForEach((x) => result += x.ToString());
            return(result);
        }
예제 #3
0
파일: Text.cs 프로젝트: JillyMan/DOT_NET
 public void CopyTo(ISentence[] array, int arrayIndex)
 {
     if (array != null && array.Length > 0)
     {
         Sentences.CopyTo(array, arrayIndex);
     }
 }
예제 #4
0
        private void CalculateDictionary()
        {
            if (Dictionary == null)
            {
                List <Token> allWords = new List <Token>();

                Sentences.ForEach(s =>
                {
                    allWords.AddRange(s.Words);
                });

                Features = allWords.Where(w => w.IsAlpha).Select(x => x.Lemma).Distinct().OrderBy(x => x).ToList();

                Dictionary = new List <Tuple <string, int> >();

                allWords.Select(x => x.Lemma)
                .Distinct()
                .OrderBy(x => x)
                .ToList()
                .ForEach(word =>
                {
                    Dictionary.Add(new Tuple <string, int>(word, allWords.Count(x => x.Lemma == word)));
                });
            }
        }
예제 #5
0
파일: Text.cs 프로젝트: JillyMan/DOT_NET
 public void Add(ISentence sentence)
 {
     if (sentence != null)
     {
         Sentences.Add(sentence);
     }
 }
        private void fillSentenseArray()
        {
            lineArray = new Sentences[tokenList[tokenList.Count - 1].Column];
            int    i             = 0;
            int    currentColumn = 1;
            string errorMessage  = null;

            while (tokenList.Count - 1 >= i)
            {
                List <Word> lineList = new List <Word>();

                for (; i < tokenList.Count && tokenList[i].Column == currentColumn; i++)
                {
                    lineList.Add(new Word(tokenList[i]));
                    if (tokenList[i].GetTypeWord() == typeArr[12])
                    {
                        errorMessage = "error type of one of operands";
                    }
                }
                if (errorMessage != null)
                {
                    lineArray[currentColumn - 1] = new Sentences(lineList, currentColumn, errorMessage);
                    currentColumn++;
                    errorMessage = null;
                    continue;
                }
                lineArray[currentColumn - 1] = new Sentences(lineList, currentColumn);
                currentColumn++;
            }

            for (int c = 0; c < lineArray.Length; c++)
            {
                lineArray[c].printLine();
            }
        }
예제 #7
0
        private void AnalyseText()
        {
            IsBusy = true;
            Sentences.Clear();
            var text = Text.Replace("\r\n", "\r");
            // 去除行首的发言人
            {
                var reg = new Regex(@"^.*:", RegexOptions.Multiline);
                text = reg.Replace(text, "");
            }
            var fkf = new[] { '.', '\"', '\r', '?', '!' };
            var cs  = text.Split(fkf);

            foreach (var l in cs)
            {
                var s = l.Trim();
                if (string.IsNullOrEmpty(s))
                {
                    continue;
                }
                Sentences.Add(new SentenceData
                {
                    Sentence = l.Trim()
                });
            }
            InitRange();
            RaisePropertyChanged("CanSave");
            FindSign();
            MakeUtfText();
            IsBusy = false;
        }
예제 #8
0
        public string ToHtmlVersion()
        {
            switch (Type)
            {
            case SectionType.PaperTitle:
                return($"<p style =\"font-weight: bold; font-size: 20px\">{Sentences[0].ToStringVersion()}</p>");

            case SectionType.SectionTitle:
                return($"<p style =\"font-weight: bold; font-size: 16px\">{Sentences[0].ToStringVersion()}</p>");

            case SectionType.Text:
                return($"<p style =\"font-size: 14px\">{string.Join(" ", Sentences.Select(x => x.ToStringVersion()))}</p>");

            case SectionType.ReferencesList:
                var sb = new StringBuilder();
                foreach (var reference in References)
                {
                    string referedToString, referedToStyle, oldSource;
                    referedToString = reference.ReferedTo ? "Есть ссылка в статье" : "Нет ссылки в статье";
                    referedToStyle  = reference.ReferedTo ? "style=\"color: green;\"" : "style=\"color: red;\"";
                    oldSource       = reference.Year != 0 && reference.Year < 1990 ? "<span style=\"color: red;\">Устаревший источник</span>" : "";


                    sb.Append($"<span>{reference.Original.Original}</span> <span {referedToStyle}>{referedToString}</span> {oldSource}\n");
                }
                return($"<p style =\"font-size: 14px\">{sb.ToString()}</p>");

            default:
                return("Что то не так");
            }
        }
예제 #9
0
 public Text(IEnumerable <ISentence> sentences) : this()
 {
     foreach (var sentence in sentences)
     {
         Sentences.Add(sentence);
     }
 }
예제 #10
0
 public void AddSentence(int sentence)
 {
     if (!Sentences.Contains(sentence))
     {
         Sentences.Add(sentence);
     }
 }
예제 #11
0
        public TokenizedText(GraphemeString graphemeString, TokenRange tokenRange)
        {
            GraphemeString = graphemeString;
            TokenRange     = tokenRange;

            for (TokenNode start = tokenRange.Start, node = tokenRange.Start; ;)
            {
                if (node.Value.Type == TokenType.FullStop || node.Value.Type == TokenType.QuestionMark || node.Value.Type == TokenType.ExclamationPoint)
                {
                    for (node = node.Next; node.Value.Type == TokenType.FullStop; node = node.Next)
                    {
                        ;
                    }
                    Sentences.Add(new TokenizedSentence(new TokenRange(start, node)));
                    start = node;
                    continue;
                }

                if (node.Value.Type == TokenType.Eof)
                {
                    if (start != node)
                    {
                        Sentences.Add(new TokenizedSentence(new TokenRange(start, node)));
                    }

                    break;
                }

                node = node.Next;
            }
        }
예제 #12
0
파일: Reversi.cs 프로젝트: Kadantte/Sanara
        protected override async Task <string[]> GetPostAsync()
        {
            StringBuilder str = new StringBuilder();

            if (_firstTurn)
            {
                str.AppendLine(Sentences.ReversiIntro(GetGuildId(), GetTurnName()));
            }
            _firstTurn = false;
            str.AppendLine("```");
            str.AppendLine("  A B C D E F G H");
            str.AppendLine(" ┌─┬─┬─┬─┬─┬─┬─┬─┐");
            for (int i = 0; i < 8; i++)
            {
                str.Append((i + 1).ToString() + "│");
                for (int y = 0; y < 8; y++)
                {
                    str.Append(_board[i, y]);
                    str.Append("│");
                }
                str.AppendLine();
                if (i != 7)
                {
                    str.AppendLine(" ├─┼─┼─┼─┼─┼─┼─┼─┤");
                }
            }
            str.AppendLine(" └─┴─┴─┴─┴─┴─┴─┴─┘");
            str.AppendLine("```");
            return(new[] { str.ToString() });
        }
예제 #13
0
 public void Write(Sentences text)
 {
     hasAlreadyWritten = true;
     StopAllCoroutines();
     currentText = text;
     StartWriting();
 }
예제 #14
0
 public Sentences(Sentences other) : this(udpipe_csharpPINVOKE.new_Sentences__SWIG_1(Sentences.getCPtr(other)), true)
 {
     if (udpipe_csharpPINVOKE.SWIGPendingException.Pending)
     {
         throw udpipe_csharpPINVOKE.SWIGPendingException.Retrieve();
     }
 }
예제 #15
0
 public SentencesEnumerator(Sentences collection)
 {
     collectionRef = collection;
     currentIndex  = -1;
     currentObject = null;
     currentSize   = collectionRef.Count;
 }
예제 #16
0
    //문장 분해
    public Sentences SentenceDecomposition(string text)
    {
        Sentences sts = new Sentences();

        sts.text = text;
        if ('t' == text [0])
        {
            sts.kind = Sentences.eKind.Translate;
        }
        if ('r' == text [0])
        {
            sts.kind = Sentences.eKind.Rotate;
        }
        if ('q' == text [0])
        {
            sts.kind = Sentences.eKind.Quaternion;
        }
        if ('s' == text [0])
        {
            sts.kind = Sentences.eKind.Scale;
        }
        CommandDecomposition(sts);

        return(sts);
    }
예제 #17
0
파일: Text.cs 프로젝트: JillyMan/DOT_NET
 public bool Remove(ISentence item)
 {
     if (item != null)
     {
         return(Sentences.Remove(item));
     }
     return(false);
 }
예제 #18
0
 public string GetSentence(string term, TimeInVid time)
 {
     if (Sentences.ContainsKey(term) && Sentences[term].ContainsKey(time.Start))
     {
         return(Sentences[term][time.Start]);
     }
     return("");
 }
예제 #19
0
파일: Text.cs 프로젝트: JillyMan/DOT_NET
 public bool Contains(ISentence item)
 {
     if (item != null)
     {
         return(Sentences.Contains(item));
     }
     return(false);
 }
예제 #20
0
 public void SetRange(int index, Sentences values)
 {
     udpipe_csharpPINVOKE.Sentences_SetRange(swigCPtr, index, Sentences.getCPtr(values));
     if (udpipe_csharpPINVOKE.SWIGPendingException.Pending)
     {
         throw udpipe_csharpPINVOKE.SWIGPendingException.Retrieve();
     }
 }
예제 #21
0
 public void SetupNetwork()
 {
     _vectors = Substitute.For<WordVectors>();
     _sentences = Substitute.For<Sentences>();
     SentenceLearner.NeuralNetworkFactory = _neuralNetworkFactory = new NeuralNetworkFactory();
     _contextMaps = new ContextMaps();
     _target = new SentenceLearner(_vectors, _sentences,_contextMaps);
 }
예제 #22
0
 public SentenceLearner(WordVectors vectors, Sentences sentences, ContextMaps contextMaps)
 {
     _vectors = vectors;
     _sentences = sentences;
     _network = NeuralNetworkFactory.CreateNeuralNetwork(
             WordVector.VectorLength + MorphoSyntacticContext.VectorLength, MorphoSyntacticContext.VectorLength, WordVector.VectorLength);
     _contextMaps = contextMaps;
     MinError = 0.01;
 }
예제 #23
0
        public void ReplaceWordsInSentences(int[] sentencesPosition, int replacableWordLenght, string replacement)
        {
            var sentences = Sentences.Where(s => sentencesPosition.Any(p => p.Equals(s.Position))).ToList();

            foreach (var sentence in sentences)
            {
                sentence.ReplaceWordsBy(replacableWordLenght, replacement);
            }
        }
예제 #24
0
파일: News.cs 프로젝트: srdrblk/AutoSummary
        private string SetSummary()
        {
            var sentenceCount      = 3;
            var firstThreeSentence = Sentences.OrderByDescending(i => i.Score).Take(sentenceCount).OrderBy(s => s.NumberOfLines).Select(s => s.Line);

            Sentences = new List <Sentence>();

            return(String.Join('.', firstThreeSentence));;
        }
예제 #25
0
        public List <string> EncodeAll()
        {
            InitDictionary();

            Sentences.ForEach(sent => Encode(sent));
            //Parallel.ForEach(Sentences, sent => Encode(sent));

            return(Words);
        }
예제 #26
0
 public void Load()
 {
     TotalCharacters = Sentences.Sum(item => item.CountCharacters());
     Sentiment.Load();
     Surface.Load();
     InquirerFinger.Load();
     SyntaxFeatures.Load();
     VocabularyObscurity.Load();
     Readability.Load();
 }
        public static string train(string method, Sentences train, Sentences heldout, string tokenizer, string tagger, string parser)
        {
            string ret = udpipe_csharpPINVOKE.Trainer_train__SWIG_1(method, Sentences.getCPtr(train), Sentences.getCPtr(heldout), tokenizer, tagger, parser);

            if (udpipe_csharpPINVOKE.SWIGPendingException.Pending)
            {
                throw udpipe_csharpPINVOKE.SWIGPendingException.Retrieve();
            }
            return(ret);
        }
예제 #28
0
 IEnumerator TypeSentence(Sentences sentence)
 {
     dialogueText.text = "";
     nameText.text     = sentence.name;
     foreach (char letter in sentence.sentence.ToCharArray())
     {
         dialogueText.text += letter;
         yield return(null);
     }
 }
예제 #29
0
 // Handle the KeyDown Event
 void gHook_KeyDown(object sender, KeyEventArgs e)
 {
     TempSentence += ((char)e.KeyValue).ToString();
     if (e.KeyCode == Keys.Return)
     {
         Sentences.Add(TempSentence);
         //OnReturn(this, TempSentence);
         TempSentence = String.Empty;
     }
 }
예제 #30
0
        public static Sentences Repeat(Sentence value, int count)
        {
            global::System.IntPtr cPtr = udpipe_csharpPINVOKE.Sentences_Repeat(Sentence.getCPtr(value), count);
            Sentences             ret  = (cPtr == global::System.IntPtr.Zero) ? null : new Sentences(cPtr, true);

            if (udpipe_csharpPINVOKE.SWIGPendingException.Pending)
            {
                throw udpipe_csharpPINVOKE.SWIGPendingException.Retrieve();
            }
            return(ret);
        }
예제 #31
0
        public void BuildPlaylist()
        {
            if (_spotify == null)
            {
                spotifyConnect();
            }
            songNames = Sentences.Split(" ");

            FullTrack      nullTrack    = _spotify.GetTrack("5QeUZ1Z4xSCegBXutW3IIt");
            PrivateProfile userProfile  = _spotify.GetPrivateProfile();
            FullPlaylist   playlistName = _spotify.CreatePlaylist(userProfile.Id, Sentences);

            foreach (string song in songNames)
            {
                SearchItem searchResults = _spotify.SearchItems(song, SearchType.Track, 30);

                if (searchResults != null)
                {
                    Paging <FullTrack> trackList = searchResults.Tracks;

                    if (trackList != null)
                    {
                        Boolean found = false;

                        for (int i = 0; i < trackList.Items.Count; i++)
                        {
                            String testName = trackList.Items[i].Name;
                            Match  isMatch  = Regex.Match(testName.ToLower(), "^" + song.ToLower());

                            if (isMatch.Success)
                            {
                                FullTrack trackName = trackList.Items[i];
                                _spotify.AddPlaylistTrack(playlistName.Id, trackName.Uri);
                                found = true;
                                break;
                            }
                        }

                        if (!found && trackList.Items.Count > 0)
                        {
                            FullTrack trackName = trackList.Items[0];
                            _spotify.AddPlaylistTrack(playlistName.Id, trackName.Uri);
                        }
                        else
                        {
                            // debug track
                            //_spotify.AddPlaylistTrack(playlistName.Id, nullTrack.Uri);
                        }
                    }
                }
            }
            tempVar   = nullTrack.Name;
            Sentences = "";
        }
예제 #32
0
 public void AddStatement(Sentence sentence)
 {
     Sentences.Add(sentence);
     foreach (string l in sentence.Symbols)
     {
         if (!Symbols.Contains(l) && l != "")
         {
             Symbols.Add(l);
         }
     }
 }
예제 #33
0
        private void SaveButton_Click(object sender, System.EventArgs e)
        {
            int result = 0;

            switch (position)
            {
                case 0:
                    Words word = new Words();
                    word.GroupId = groupSpinner.SelectedItemPosition + 1;
                    word.SubGroupId = subgroupSpinner.SelectedItemPosition + 1;
                    word.Word = contentText.Text;

                    result = repository.Save(word);
                    break;

                case 1:
                    Sentences sentence = new Sentences();
                    sentence.Sentence = contentText.Text;

                    result = repository.Save(sentence);
                    break;

                case 2:
                    Poems poem = new Poems();
                    poem.Title = poemTitleText.Text;
                    poem.Poem = contentText.Text;

                    result = repository.Save(poem);
                    break;
            }

            string message = result == 1 ? "Zapisano" : "B³¹d zapisu!";

            Toast.MakeText(this, message, ToastLength.Long).Show();

            OnBackPressed();
        }
    static void Main(string[] args)
    {
        string parsed_sentences = @"F:\Corpus\parsing\ru\SENT4.parsing.txt";
        string result_path = @"f:\tmp\negative3.dat";
        string dict_path = @"e:\MVoice\lem\bin-windows64\dictionary.xml";

        // Загрузим морфологический словарь, он нам понадобится для смены падежей слов.
        SolarixGrammarEngineNET.GrammarEngine2 gren = new SolarixGrammarEngineNET.GrammarEngine2();
        gren.Load(dict_path, true);


        string[] files = null;
        if (System.IO.Directory.Exists(parsed_sentences))
            files = System.IO.Directory.GetFiles(parsed_sentences, "*.parsing.txt");
        else
            files = new string[1] { parsed_sentences };

        List<TreeTemplate> templates = new List<TreeTemplate>();
        templates.Add(new TreeTemplate("[class:ГЛАГОЛ]( <PREPOS_ADJUNCT>[class:ПРЕДЛОГ].<OBJECT>[class:МЕСТОИМЕНИЕ,СУЩЕСТВИТЕЛЬНОЕ,ПРИЛАГАТЕЛЬНОЕ] )"));

        sample_count = 0;

        using (wrt = new System.IO.StreamWriter(result_path))
        {
            foreach (string file in files)
            {
                Console.WriteLine("Processing {0}...", file);

                using (Sentences src = new Sentences(file))
                {
                    while (src.Next())
                    {
                        Sentence sent = src.GetFetched();
                        if (sent.root != null)
                        {
                            #region AdjNounAdjNoun

                            for (int i1 = 0; i1 < sent.Tokens.Count; ++i1)
                            {
                                if (sent.Tokens[i1].part_of_speech == "СУЩЕСТВИТЕЛЬНОЕ")
                                {
                                    SNode node1 = sent.Nodes.Where(z => z.index == i1).First();
                                    if (node1.edge_types.Count > 0)
                                    {
                                        int edge1 = -1;

                                        for (int j1 = 0; j1 < node1.edge_types.Count; ++j1)
                                        {
                                            if (node1.edge_types[j1] == "ATTRIBUTE")
                                            {
                                                if (sent.Tokens[node1.children[j1].index].part_of_speech == "ПРИЛАГАТЕЛЬНОЕ")
                                                {
                                                    edge1 = j1;
                                                    break;
                                                }
                                            }
                                        }

                                        if (edge1 != -1)
                                        {
                                            // Нашли первое существительное с атрибутирующим прилагательным.
                                            int noun_ie1 = gren.FindEntry(sent.Tokens[i1].word, gren.FindPartOfSpeech(sent.Tokens[i1].part_of_speech));

                                            SToken adj1 = sent.Tokens[node1.children[edge1].index];
                                            adj1.word = adj1.word.ToLower();


                                            for (int i2 = i1 + 2; i2 < sent.Tokens.Count; ++i2)
                                            {
                                                if (sent.Tokens[i2].part_of_speech == "СУЩЕСТВИТЕЛЬНОЕ")
                                                {
                                                    int noun_ie2 = gren.FindEntry(sent.Tokens[i2].word, gren.FindPartOfSpeech(sent.Tokens[i2].part_of_speech));

                                                    if (noun_ie1 != noun_ie2)
                                                    {
                                                        int gender1 = gren.GetEntryAttrState(noun_ie1, SolarixGrammarEngineNET.GrammarEngineAPI.GENDER_ru);
                                                        int gender2 = gren.GetEntryAttrState(noun_ie2, SolarixGrammarEngineNET.GrammarEngineAPI.GENDER_ru);
                                                        if (gender1 == gender2)
                                                        {
                                                            string number1 = sent.Tokens[i1].tags.Where(z => z.StartsWith("ЧИСЛО:")).First().Split(':')[1];
                                                            string number2 = sent.Tokens[i2].tags.Where(z => z.StartsWith("ЧИСЛО:")).First().Split(':')[1];

                                                            if (number1 == number2)
                                                            {
                                                                SNode node2 = sent.Nodes.Where(z => z.index == i2).First();
                                                                if (node2.edge_types.Count > 0)
                                                                {
                                                                    int edge2 = -1;

                                                                    for (int j2 = 0; j2 < node2.edge_types.Count; ++j2)
                                                                    {
                                                                        if (node2.edge_types[j2] == "ATTRIBUTE")
                                                                        {
                                                                            if (sent.Tokens[node2.children[j2].index].part_of_speech == "ПРИЛАГАТЕЛЬНОЕ")
                                                                            {
                                                                                edge2 = j2;
                                                                                break;
                                                                            }
                                                                        }
                                                                    }

                                                                    if (edge2 != -1)
                                                                    {
                                                                        // Нашли второе существительное с атрибутирующим прилагательным.
                                                                        SToken adj2 = sent.Tokens[node2.children[edge2].index];
                                                                        adj2.word = adj2.word.ToLower();


                                                                        // Сгенерируем предложение, в котором эти прилагательные поменяны местами.
                                                                        List<SToken> tokens2 = new List<SToken>();
                                                                        foreach (SToken t in sent.Tokens)
                                                                        {
                                                                            if (t.index == adj1.index)
                                                                            {
                                                                                tokens2.Add(adj2);
                                                                            }
                                                                            else if (t.index == adj2.index)
                                                                            {
                                                                                tokens2.Add(adj1);
                                                                            }
                                                                            else
                                                                            {
                                                                                tokens2.Add(t);
                                                                            }
                                                                        }

                                                                        StoreSample(sent, tokens2);
                                                                    }
                                                                    else
                                                                    {
                                                                        // у второго существительного нет атрибутирующего прилагательного.
                                                                        // перенесем прилагательное от первого ко второму существительному.

                                                                        List<SToken> tokens2 = new List<SToken>();
                                                                        foreach (SToken t in sent.Tokens)
                                                                        {
                                                                            if (t.index == adj1.index)
                                                                            {
                                                                                continue;
                                                                            }
                                                                            else if (t.index == i2)
                                                                            {
                                                                                tokens2.Add(adj1);
                                                                                tokens2.Add(sent.Tokens[i2]);
                                                                            }
                                                                            else
                                                                            {
                                                                                tokens2.Add(t);
                                                                            }
                                                                        }

                                                                        StoreSample(sent, tokens2);

                                                                    }

                                                                }

                                                            }
                                                        }
                                                    }
                                                }
                                            }
                                        }
                                    }
                                }
                            }

                            #endregion AdjNounAdjNoun


                            #region NounNoun
                            // Ищем два существительных, связанных в конструкцию родительного дополнения:
                            // "восход солнца"
                            // Генерируем предложение с перестановкой слов и сменой падежей:
                            // "солнце восхода"
                            foreach (SNode n1 in sent.Nodes)
                            {
                                SToken t1 = sent.Tokens[n1.index]; // восход
                                if (t1.part_of_speech == "СУЩЕСТВИТЕЛЬНОЕ")
                                {
                                    if (n1.children.Count > 0)
                                    {
                                        int gen_edge_index = n1.edge_types.IndexOf("RIGHT_GENITIVE_OBJECT");
                                        if (gen_edge_index != -1)
                                        {
                                            SToken t2 = sent.Tokens[n1.children[gen_edge_index].index]; // солнца

                                            if (gen_edge_index != -1 && t2.part_of_speech == "СУЩЕСТВИТЕЛЬНОЕ")
                                            {
                                                List<SToken> tokens2 = new List<SToken>();
                                                bool t12_ok = true;
                                                foreach (SToken t in sent.Tokens)
                                                {
                                                    if (t.index == t1.index)
                                                    {
                                                        // сюда вставляем слово "солнца" и меняем его падеж на падеж слова t
                                                        string t_case = t.tags.Where(z => z.StartsWith("ПАДЕЖ:")).First().Split(':')[1];
                                                        string t_number = t2.tags.Where(z => z.StartsWith("ЧИСЛО:")).First().Split(':')[1];
                                                        int ie_t2 = gren.FindEntry(t2.lemma, gren.FindPartOfSpeech(t2.part_of_speech));
                                                        if (ie_t2 != -1)
                                                        {
                                                            List<int> coords = new List<int>();
                                                            List<int> states = new List<int>();
                                                            coords.Add(SolarixGrammarEngineNET.GrammarEngineAPI.CASE_ru);
                                                            states.Add(gren.FindState(SolarixGrammarEngineNET.GrammarEngineAPI.CASE_ru, t_case));
                                                            coords.Add(SolarixGrammarEngineNET.GrammarEngineAPI.NUMBER_ru);
                                                            states.Add(gren.FindState(SolarixGrammarEngineNET.GrammarEngineAPI.NUMBER_ru, t_number));
                                                            List<string> forms = gren.GenerateWordforms(ie_t2, coords, states);
                                                            if (forms.Count > 0)
                                                            {
                                                                string new_word = gren.RestoreCasing(ie_t2, forms[0]);
                                                                SToken new_t = new SToken();
                                                                new_t.index = t.index;
                                                                new_t.word = new_word;
                                                                new_t.lemma = t.lemma;
                                                                new_t.part_of_speech = t1.part_of_speech;
                                                                tokens2.Add(new_t);
                                                            }
                                                            else
                                                            {
                                                                t12_ok = false;
                                                            }
                                                        }
                                                        else
                                                        {
                                                            t12_ok = false;
                                                        }
                                                    }
                                                    else if (t.index == t2.index)
                                                    {
                                                        // сюда вставляем слово "восход" и меняем его падеж на родительный
                                                        string t_number = t1.tags.Where(z => z.StartsWith("ЧИСЛО:")).First().Split(':')[1];
                                                        int ie_t1 = gren.FindEntry(t1.lemma, gren.FindPartOfSpeech(t1.part_of_speech));
                                                        if (ie_t1 != -1)
                                                        {
                                                            List<int> coords = new List<int>();
                                                            List<int> states = new List<int>();
                                                            coords.Add(SolarixGrammarEngineNET.GrammarEngineAPI.CASE_ru);
                                                            states.Add(SolarixGrammarEngineNET.GrammarEngineAPI.GENITIVE_CASE_ru);
                                                            coords.Add(SolarixGrammarEngineNET.GrammarEngineAPI.NUMBER_ru);
                                                            states.Add(gren.FindState(SolarixGrammarEngineNET.GrammarEngineAPI.NUMBER_ru, t_number));
                                                            List<string> forms = gren.GenerateWordforms(ie_t1, coords, states);
                                                            if (forms.Count > 0)
                                                            {
                                                                string new_word = gren.RestoreCasing(ie_t1, forms[0]);
                                                                SToken new_t = new SToken();
                                                                new_t.index = t.index;
                                                                new_t.word = new_word;
                                                                new_t.lemma = t.lemma;
                                                                new_t.part_of_speech = t.part_of_speech;
                                                                tokens2.Add(new_t);
                                                            }
                                                            else
                                                            {
                                                                t12_ok = false;
                                                            }
                                                        }
                                                        else
                                                        {
                                                            t12_ok = false;
                                                        }

                                                    }
                                                    else
                                                    {
                                                        tokens2.Add(t);
                                                    }
                                                }

                                                if (t12_ok)
                                                {
                                                    StoreSample(sent, tokens2);
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                            #endregion NounNoun


                            #region PrepObject
                            // Ищем предлог.
                            foreach (SToken token_prepos in sent.Tokens)
                            {
                                if (token_prepos.part_of_speech == "ПРЕДЛОГ")
                                {
                                    // Нашли предлог. Теперь перенесем его в другую позицию.
                                    List<Tuple<SToken, float>> tokens2 = sent.Tokens.Where(z => z.index != token_prepos.index).Select(z => new Tuple<SToken, float>(z, z.index)).ToList();

                                    foreach (var t2 in tokens2.Where(z => z.Item1.index != token_prepos.index + 1))
                                    {
                                        // Ставим предлог в позицию ПЕРЕД токеном t2 и генерируем предложение.
                                        List<Tuple<SToken, float>> tokens3 = new List<Tuple<SToken, float>>();
                                        tokens3.AddRange(tokens2);
                                        tokens3.Add(new Tuple<SToken, float>(token_prepos, t2.Item2 - 0.5f));

                                        StoreSample(sent, tokens3.OrderBy(z => z.Item2).Select(z => z.Item1).ToList());
                                    }
                                }
                            }
                            #endregion PrepObject


                            /*
                                                        foreach (TreeTemplate t in templates)
                                                        {
                                                            if (t.Match(sent))
                                                            {
                                                            }
                                                        }
                            */
                        }
                    }
                }
            }
        }

        Console.WriteLine("\nsample_count={0}", sample_count);

        return;
    }