nuget server logo nuget api documents
↑

API Docs / Microsoft.VisualBasic.Data.NLP / Stemmer

Stemmer

Full name Microsoft.VisualBasic.Data.NLP.Stemmer Assembly Microsoft.VisualBasic.Data.NLP Members 6

Stemmer, implementing the Porter Stemming Algorithm

The Stemmer class transforms a word into its root form. The input word can be provided a character at time (by calling add()), or at once by calling one of the various stem(something) methods.

https://github.com/meefen/npl-lab/tree/master

00 Remarks

The Porter stemming algorithm is a process for removing the commoner morphological and inflexional endings from words in English. Its main use is as part of a term normalization process that is usually done when setting up Information Retrieval systems.

History and Development:

  • The algorithm was developed by Martin Porter in 1980.
  • It has become one of the most popular stemming algorithms in English, largely due to its simplicity and effectiveness.

How it Works:

  • The Porter stemmer works by applying a series of rules that remove or replace word endings. These rules are applied in a specific order, and they are designed to handle different inflections and suffixes.
  • The rules are divided into steps, and each step contains a set of conditions and transformations. If a word meets a certain condition, a specific transformation is applied.
  • The algorithm uses a series of suffix replacement rules to reduce words to their root form. For example, "running" might be reduced to "run" by removing the "-ing" suffix.

Steps in the Algorithm:

  1. Plural Reduction: Removes plural suffixes, like "-s" or "-es".
  2. Past Tense Reduction: Changes past tense endings, such as "-ed".
  3. Adjective to Adverb Reduction: Handles suffixes that convert adjectives to adverbs, like "-ly".
  4. Progressive Reduction: Deals with progressive tense endings, such as "-ing".
  5. Suffix Reduction: Applies a series of more complex rules to handle various other suffixes.

Advantages:

  • Simplicity: The algorithm is relatively simple to implement and understand.
  • Effectiveness: It works well for a wide range of English words, reducing them to their base or root form.
  • Broad Applicability: It is used in various applications, including search engines, text analysis, and natural language processing.

Disadvantages:

  • Over-Stemming: Sometimes it reduces words too aggressively, leading to over-stemming. For example, "university" might be reduced to "univers", which is not a valid English word.
  • Under-Stemming: It may fail to reduce related words to the same stem. For example, "meeting" and "meet" might not be reduced to the same stem.
  • Language Specific: It is designed specifically for English and may not work well for other languages.

Applications:

  • Information Retrieval: Improves the accuracy of search engines by reducing words to their base form, allowing for more effective matching of queries to documents.
  • Text Mining: Helps in analyzing large collections of text by reducing the dimensionality of the data.
  • Natural Language Processing (NLP): Used in various NLP tasks, such as text classification, clustering, and summarization.

Extensions and Variants:

  • Over the years, several extensions and variants of the Porter stemmer have been developed to address its limitations and improve its performance. These include the Snowball stemmer and the Porter2 stemmer.

In summary, the Porter stemming algorithm is a foundational technique in text processing that helps in normalizing words to their base form, thereby enhancing the efficiency and effectiveness of various text-based applications. Despite its limitations, it remains a widely used and influential algorithm in the field of computational linguistics and information retrieval.

01 Syntax

Microsoft.VisualBasic.Data.NLP.Stemmer

02 Methods

NameOverloadsSummary
add 2 Add a character to the word being stemmed.
ToString 1 After a word has been stemmed, it can be retrieved by toString(), or a reference to the internal buffer can be retrieved by getResultBuffer and getResultLength (which is generall…
stem 1 Stem the word placed into the Stemmer buffer through calls to add().

03 Properties

NameOverloadsSummary
ResultLength 1 Returns the length of the word resulting from the stemming process.
ResultBuffer 1 Returns a reference to a character buffer containing the results of the stemming process.

04 Members

method add #
add(Char)

Add a character to the word being stemmed. When you are finished adding characters, you can call stem(void) to stem the word.

method add overload 2 #
add(Char(), Int32)

Adds wLen characters to the word being stemmed contained in a portion of a char[] array. This is like repeated calls of add(char ch), but faster.

method ToString #
ToString

After a word has been stemmed, it can be retrieved by toString(), or a reference to the internal buffer can be retrieved by getResultBuffer and getResultLength (which is generally more efficient.)

method stem #
stem

Stem the word placed into the Stemmer buffer through calls to add(). Returns true if the stemming process resulted in a word different from the input. You can retrieve the result with getResultLength()/getResultBuffer() or toString().

property ResultLength #
ResultLength

Returns the length of the word resulting from the stemming process.

property ResultBuffer #
ResultBuffer

Returns a reference to a character buffer containing the results of the stemming process. You also need to consult getResultLength() to determine the length of the result.