private void MatchWordsInSentences()
        {
            // Get words from sentences
            SentenceMaker sf = new SentenceMaker();

            sf.SplitSentence(inputData.paragraph, clsConstant.StringSplitPattern.sentenceForm);

            foreach (var sentence in sf.sentences)
            {
                Tokenizer TSentence = new Tokenizer();
                GetTokens(TSentence, sentence);
                MatchQuestionAndAnswer(TSentence, sentence);
            }

            //ParallelOptions lParallelOptions = new ParallelOptions() { MaxDegreeOfParallelism = 5 };
            //Parallel.ForEach(sf.sentences, lParallelOptions, sentence =>
            //{
            //    try
            //    {
            //        Tokenizer TSentence = new Tokenizer();
            //        GetTokens(TSentence, sentence);
            //        MatchQuestionAndAnswer(inputData, TSentence, sentence);
            //    }
            //    catch (Exception e)
            //    {

            //    }
            //});


            //DisplayResult d = new DisplayResult();
            //d.ShowResult(colQARank, e.answer);
        }
Esempio n. 2
0
        public void MatchWordsInSentences(ParagraphQA inputData)
        {
            // Get words from sentences
            SentenceMaker sf = new SentenceMaker();

            sf.SplitSentence(inputData.paragraph, clsConstant.StringSplitPattern.sentenceForm);

            foreach (var sentence in sf.sentences)
            {
                Tokenizer TSentence = new Tokenizer();
                GetTokens(TSentence, sentence);
                MatchQuestionAndAnswer(inputData, TSentence, sentence);
            }

            DisplayResult d = new DisplayResult();

            d.ShowResult(colQARank, inputData.answer);
        }