Exemplo n.º 1
0
        internal ParsedReview(INRCDictionary dictionary, Document document)
        {
            if (document is null)
            {
                throw new ArgumentNullException(nameof(document));
            }

            if (document.DocumentTime.HasValue &&
                document.DocumentTime.Value.Ticks > 0)
            {
                Date = document.DocumentTime.Value;
            }

            Document = document;
            text     = document.Text;
            Vector   = new ExtractReviewTextVector(dictionary, this);
        }
Exemplo n.º 2
0
        public async Task GetCells(bool generate, bool addFeature, int total, string prefix, string lastWord)
        {
            if (addFeature)
            {
                detector.AddFeature(ActualWordsHandler.InstanceSimple.WordFactory.CreateWord("teacher", POSTags.Instance.NN));
            }

            var data = await splitter.Process(new ParseRequest($"I go to school. I like {prefix} teacher.")).ConfigureAwait(false);

            var document = data.Construct(ActualWordsHandler.InstanceSimple.WordFactory);

            review   = ActualWordsHandler.InstanceSimple.Container.Resolve <Func <Document, IParsedReviewManager> >()(document).Create();
            instance = new ExtractReviewTextVector(ActualWordsHandler.InstanceSimple.Container.Resolve <INRCDictionary>(), review)
            {
                GenerateUsingImportantOnly = generate
            };
            IList <TextVectorCell> cells = instance.GetCells();

            Assert.AreEqual(total + 1, cells.Count);

            // feature is always
            Assert.AreEqual(lastWord, cells[cells.Count - 1].Name);
        }