public Task FindText(string text, Progress <int> progress, CancellationToken token) { return(Task.Run(async() => { await foreach (var offsetOccurence in searcher.Search(CarretSelectionOffset + CarretSelectionLength, text.ToCharArray(), progress, token)) { await await Dispatcher.InvokeAsync(async() => { long lineBeginningOffset = await GoToOffset(offsetOccurence, true); TxtContent.Select((int)(offsetOccurence - lineBeginningOffset), text.Length); App.Current.MainWindow.Activate(); }); break; } })); }
public void SendQuery(string query) { var n1GrammQuery = TextConvertor.TextToWordList(query); var texts = TextSearcher.Search(query); foreach (string text in texts) { var n1GrammText = TextConvertor.TextToWordList(text); var vectorizedText = _word2VecModelDB.CreateWordVectorList(n1GrammText); var vectorizedQuery = _word2VecModelDB.CreateWordVectorList(n1GrammQuery); var score = Cluster.GetAccordance(WordVector.GetVectors(vectorizedText), WordVector.GetVectors(vectorizedQuery)); _view.ShowTextWithScore(text, score); } }