Exemplo n.º 1
0
            public void RemoveOtherSPluralSuffix_WithShortWordEndingInIed_ReplaceWithIe()
            {
                const string word    = "tied";
                var          stemmer = new PortersStemmer();

                // Act
                var actual = stemmer.Step1ARemoveOtherSPluralSuffixes(word);

                // Assert
                Assert.AreEqual("tie", actual);
            }
Exemplo n.º 2
0
            public void RemoveOtherSPluralSuffix_EndingInSAndContainingAVowelRightBefore_LeavesTheS()
            {
                const string word    = "gas";
                var          stemmer = new PortersStemmer();

                // Act
                var actual = stemmer.Step1ARemoveOtherSPluralSuffixes(word);

                // Assert
                Assert.AreEqual("gas", actual);
            }
Exemplo n.º 3
0
            public void RemoveSPluralSuffix_WithWordEndingInApostropheSApostrophe_RemovesSuffix()
            {
                const string word    = "holy's'";
                var          stemmer = new PortersStemmer();

                // Act
                var actual = stemmer.Step0RemoveSPluralSuffix(word);

                // Assert
                Assert.AreEqual("holy", actual);
            }
Exemplo n.º 4
0
            public void RemoveOtherSPluralSuffix_WithLongWordEndingInIes_ReplaceWithI()
            {
                const string word    = "cries";
                var          stemmer = new PortersStemmer();

                // Act
                var actual = stemmer.Step1ARemoveOtherSPluralSuffixes(word);

                // Assert
                Assert.AreEqual("cri", actual);
            }
Exemplo n.º 5
0
            public void MarkVowelsAsConsonants_WithNoVowelsButY_DoesNotMarkAnyYAsConsonant()
            {
                const string word    = "syzygy";
                var          stemmer = new PortersStemmer();

                // Act
                var actual = stemmer.MarkYsAsConsonants(word);

                // Assert
                Assert.AreEqual("syzygy", actual);
            }
Exemplo n.º 6
0
            public void MarkVowelsAsConsonants_WithDoubledY_MarksFirstButNotSecondYAsConsonant()
            {
                const string word    = "sayyid";
                var          stemmer = new PortersStemmer();

                // Act
                var actual = stemmer.MarkYsAsConsonants(word);

                // Assert
                Assert.AreEqual("saYyid", actual);
            }
Exemplo n.º 7
0
            public void MarkVowelsAsConsonants_WithVowelOnlyFollowingY_DoesNotMarkYAsConsonant()
            {
                const string word    = "flying";
                var          stemmer = new PortersStemmer();

                // Act
                var actual = stemmer.MarkYsAsConsonants(word);

                // Assert
                Assert.AreEqual("flying", actual);
            }
Exemplo n.º 8
0
            public void MarkVowelsAsConsonants_WithYBetweenTwoVowels_MarksYAsConsonant()
            {
                const string word    = "boyish";
                var          stemmer = new PortersStemmer();

                // Act
                var actual = stemmer.MarkYsAsConsonants(word);

                // Assert
                Assert.AreEqual("boYish", actual);
            }
Exemplo n.º 9
0
            public void MarkVowelsAsConsonants_WithInitialY_MarksYAsConsonant()
            {
                const string word    = "youth";
                var          stemmer = new PortersStemmer();

                // Act
                var actual = stemmer.MarkYsAsConsonants(word);

                // Assert
                Assert.AreEqual("Youth", actual);
            }
Exemplo n.º 10
0
            public void ReplaceYSuffix_PreceededByConsonant_ReplacesSuffixWithI()
            {
                const string word    = "cry";
                var          stemmer = new PortersStemmer();

                // Act
                var actual = stemmer.Step1CReplaceSuffixYWithIIfPreceededWithConsonant(word);

                // Assert
                Assert.AreEqual("cri", actual);
            }
Exemplo n.º 11
0
            public void ReplaceYSuffix_NotPreceededyConsonant_DoesNotReplaceSuffix()
            {
                const string word    = "say";
                var          stemmer = new PortersStemmer();

                // Act
                var actual = stemmer.Step1CReplaceSuffixYWithIIfPreceededWithConsonant(word);

                // Assert
                Assert.AreEqual("say", actual);
            }
Exemplo n.º 12
0
            public void RemoveLySuffixes_EndingInIngAndIsShortWord_ReplacesSuffixWithE()
            {
                const string word    = "hoping";
                var          stemmer = new PortersStemmer();

                // Act
                var actual = stemmer.Step1BRemoveLySuffixes(word, stemmer.GetRegion1(word));

                // Assert
                Assert.AreEqual("hope", actual);
            }
Exemplo n.º 13
0
            public void RemoveLySuffixes_EndingInIngAndDoubledLetterProceedsThat_RemovesDoubledLetter()
            {
                const string word    = "hopping";
                var          stemmer = new PortersStemmer();

                // Act
                var actual = stemmer.Step1BRemoveLySuffixes(word, stemmer.GetRegion1(word));

                // Assert
                Assert.AreEqual("hop", actual);
            }
Exemplo n.º 14
0
            public void RemoveLySuffixes_EndingInEdAndDoesNotContainVowel_LeavesWord()
            {
                const string word    = "fred";
                var          stemmer = new PortersStemmer();

                // Act
                var actual = stemmer.Step1BRemoveLySuffixes(word, stemmer.GetRegion1(word));

                // Assert
                Assert.AreEqual("fred", actual);
            }
Exemplo n.º 15
0
            public void RemoveLySuffixes_EndingInInglyAndAtProceedsThat_ReplacesSuffixWithE()
            {
                const string word    = "luxuriated";
                var          stemmer = new PortersStemmer();

                // Act
                var actual = stemmer.Step1BRemoveLySuffixes(word, stemmer.GetRegion1(word));

                // Assert
                Assert.AreEqual("luxuriate", actual);
            }
Exemplo n.º 16
0
            public void RemoveLySuffixes_EndingInEedAndInR1_ReplacesSuffixWithEe()
            {
                const string word    = "inbreed";
                var          stemmer = new PortersStemmer();

                // Act
                var actual = stemmer.Step1BRemoveLySuffixes(word, stemmer.GetRegion1(word));

                // Assert
                Assert.AreEqual("inbree", actual);
            }
Exemplo n.º 17
0
            public void RemoveOtherSPluralSuffix_EndingInUs_LeavesWordAlone()
            {
                const string word    = "consensus";
                var          stemmer = new PortersStemmer();

                // Act
                var actual = stemmer.Step1ARemoveOtherSPluralSuffixes(word);

                // Assert
                Assert.AreEqual("consensus", actual);
            }
Exemplo n.º 18
0
            public void RemoveOtherSPluralSuffix_EndingInSAndContainingAVowelRightBeforeAndEarlierInWord_DeletesTheS()
            {
                const string word    = "kiwis";
                var          stemmer = new PortersStemmer();

                // Act
                var actual = stemmer.Step1ARemoveOtherSPluralSuffixes(word);

                // Assert
                Assert.AreEqual("kiwi", actual);
            }
Exemplo n.º 19
0
            public void EndInShortSyllable_TestingDisturb_IsCountedAsShort()
            {
                // Arrange
                const string word    = "disturb";
                var          stemmer = new PortersStemmer();

                // Act
                var actual = stemmer.EndsInShortSyllable(word);

                // Assert
                Assert.IsFalse(actual);
            }
Exemplo n.º 20
0
            public void GetRegion2_WithWordContainingRegion1AndRegion2_ProvidesCorrectRangeForRegion2()
            {
                // Arrange
                const string word    = "beautiful";
                var          stemmer = new PortersStemmer();

                // Act
                var actual = stemmer.GetRegion2(word);

                // Assert
                Assert.AreEqual(7, actual);
            }
Exemplo n.º 21
0
            public void IsShortWord_TestingBeds_IsNotCountedAsShort()
            {
                // Arrange
                const string word    = "beds";
                var          stemmer = new PortersStemmer();

                // Act
                var actual = stemmer.IsShortWord(word);

                // Assert
                Assert.IsFalse(actual);
            }
Exemplo n.º 22
0
            public void GetRegion1_WithWordContainingOnlyRegion1_ProvidesCorrectRangeForRegion1()
            {
                // Arrange
                const string word    = "beauty";
                var          stemmer = new PortersStemmer();

                // Act
                var actual = stemmer.GetRegion1(word);

                // Assert
                Assert.AreEqual(5, actual);
            }
Exemplo n.º 23
0
            public void IsShortWord_TestingShred_IsCountedAsShort()
            {
                // Arrange
                const string word    = "shred";
                var          stemmer = new PortersStemmer();

                // Act
                var actual = stemmer.IsShortWord(word);

                // Assert
                Assert.IsTrue(actual);
            }
Exemplo n.º 24
0
            public void GetRegion2_WithWordContainingOnlyRegion1_ProvidesRangeWithLength0()
            {
                // Arrange
                const string word    = "beauty";
                var          stemmer = new PortersStemmer();

                // Act
                var actual = stemmer.GetRegion2(word);

                // Assert
                Assert.AreEqual(0, actual - word.Length);
            }
Exemplo n.º 25
0
            public void EndInShortSyllable_TestingEntrap_IsCountedAsShort()
            {
                // Arrange
                const string word    = "entrap";
                var          stemmer = new PortersStemmer();

                // Act
                var actual = stemmer.EndsInShortSyllable(word);

                // Assert
                Assert.IsTrue(actual);
            }