public void AddRemove()
        {
            var word   = new TestWordItem("xxx");
            var result = instance.IsAspect(word);

            Assert.IsFalse(result);
            instance.AddFeature(word);
            result = instance.IsAspect(word);
            Assert.IsTrue(result);
            instance.Remove(word);
            result = instance.IsAspect(word);
            Assert.IsFalse(result);
        }
        public async Task Setup()
        {
            var aspect = new AspectDectector(new IWordItem[] { }, new IWordItem[] { });

            ActualWordsHandler.InstanceSimple.Container.Context.ChangeAspect(aspect);
            aspect.AddFeature(ActualWordsHandler.InstanceSimple.WordFactory.CreateWord("teacher", POSTags.Instance.NN));
            var data = await ActualWordsHandler.InstanceSimple.TextSplitter.Process(new ParseRequest("I like my school teacher.")).ConfigureAwait(false);

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

            review = ActualWordsHandler.InstanceSimple.Container.Resolve <Func <Document, IParsedReviewManager> >()(document).Create();
            var sentence = review.Sentences[0];

            instance = new ExtractSentenceTextVector(sentence);
        }
Esempio n. 3
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);
        }