Пример #1
0
        public override void Compute()
        {
            TLArtifactsCollection listOfArtifacts = (TLArtifactsCollection)Workspace.Load("listOfArtifacts");
            TLStopwords           stopwords       = (TLStopwords)Workspace.Load("Stopwords");
            TLArtifactsCollection removed         = StopwordsRemover.ProcessArtifacts(listOfArtifacts, stopwords, _config.MinWordLength, _config.RemoveNumbers);

            Workspace.Store("listOfArtifacts", removed);
        }
Пример #2
0
        public void CleanArtifactsWithStopwords()
        {
            TLArtifactsCollection artifacts = new TLArtifactsCollection();

            artifacts.Add(new TLArtifact("id1", "clean these words"));
            artifacts.Add(new TLArtifact("id2", "this has a stopword"));
            artifacts.Add(new TLArtifact("id3", "an expression"));

            TLStopwords stopwords = new TLStopwords();

            stopwords.Add("these");
            stopwords.Add("this");

            TLArtifactsCollection processedArtifacts = StopwordsRemover.ProcessArtifacts(artifacts, stopwords, 4, false);

            Assert.AreEqual(processedArtifacts["id1"].Text, "clean words");
            Assert.AreEqual(processedArtifacts["id2"].Text, "stopword");
            Assert.AreEqual(processedArtifacts["id3"].Text, "expression");
        }