Noun * NounTemplate::spawn() { Noun * pTemplate = noun(); if ( pTemplate != NULL ) { // cloning automatically generates a new key Noun * pCopy = WidgetCast<Noun>( pTemplate->copy() ); ASSERT( pCopy ); return( pCopy ); } return( NULL ); }
String RussianStemmer::stem(const String& input) { markPositions(input); if (RV == 0) return input; // RV wasn't detected, nothing to stem String stemmingZone(input.substr(RV)); // stemming goes on in RV // Step 1 if (!perfectiveGerund(stemmingZone)) { reflexive(stemmingZone); if (!adjectival(stemmingZone)) { if (!verb(stemmingZone)) noun(stemmingZone); } } // Step 2 removeI(stemmingZone); // Step 3 derivational(stemmingZone); // Step 4 superlative(stemmingZone); undoubleN(stemmingZone); removeSoft(stemmingZone); // return result return input.substr(0, RV) + stemmingZone; }