Implementation:Googleapis Python genai Sphinx EnglishStemmer
| Knowledge Sources | |
|---|---|
| Domains | Documentation, NLP, Text_Processing |
| Last Updated | 2026-02-15 14:00 GMT |
Overview
Concrete tool implementing the English Porter/Snowball stemming algorithm for the Sphinx documentation search engine.
Description
The EnglishStemmer class extends BaseStemmer with English-specific morphological rules. It implements the multi-step Porter stemming algorithm: apostrophe handling (r_prelude), region marking (r_mark_regions), suffix removal steps 1a through 5 (r_Step_1a through r_Step_5), exception handling (r_exception1), and Y-to-y postprocessing (r_postlude). Contains 12 suffix lookup tables and character group definitions for vowels and consonants. This is a Sphinx documentation asset generated from Snowball grammar, not part of the GenAI SDK.
Usage
This JavaScript file is loaded by the Sphinx documentation site to reduce English words to their root form during full-text search, improving recall by matching related word forms.
Code Reference
Source Location
- Repository: Googleapis_Python_genai
- File: docs/_static/english-stemmer.js
- Lines: 1-1066
Signature
var EnglishStemmer = function() {
BaseStemmer.call(this);
this.stem = function() { ... }; // Execute full stemming pipeline
this.stemWord = function(word) { ... }; // Convenience: stem a single word
};
Import
<script src="_static/base-stemmer.js"></script>
<script src="_static/english-stemmer.js"></script>
I/O Contract
Inputs
| Name | Type | Required | Description |
|---|---|---|---|
| word | string | Yes (stemWord) | English word to stem |
Outputs
| Name | Type | Description |
|---|---|---|
| stemWord() returns | string | Root form of the input word |
| stem() modifies | internal state | Applies stemming rules to current buffer |
Usage Examples
var stemmer = new EnglishStemmer();
// Stem individual words
stemmer.stemWord("running"); // "run"
stemmer.stemWord("connections"); // "connect"
stemmer.stemWord("generalized"); // "general"
// Used by Search.performTermsSearch() to match query terms
Related Pages
(No SDK environment or heuristic dependencies - documentation asset only)