++



         

- 3


}

void

TextQuery::

filter_text()

{

if ( filt_elems.empty() )

return;

vector<string,allocator> *words = text_locations->first;

vector<string,allocator>::iterator iter = words->begin();

vector<string,allocator>::iterator iter_end = words->end();

while ( iter != iter_end )

{

string::size_type pos = 0;

while ((pos = (*iter).find_first_of(filt_elems, pos))

!= string::npos )

(*iter).erase(pos,l);

++iter;

}

}

void

TextQuery::

suffix_text()

{

vector<string,allocator> *words = text_locations->first;

vector<string,allocator>::iterator iter = words->begin();

vector<string,allocator>::iterator iter_end = words->end() ;

while ( iter != iter_end ) {

if ( (*iter).size() <= 3 )

{ iter++; continue; }

if ( (*iter)[ (*iter).size()-l ] == 's' )

suffix_s( *iter );

// ...

iter++;

}

}

void

TextQuery::

suffix_s( string &word )

{

string::size_type spos = 0;

string::size_type pos3 = word.size()-3;

// "ous", "ss", "is", "ius"

string suffixes( "oussisius" );

if ( ! word.compare( pos3, 3, suffixes, spos, 3 ) ||

! word.compare( pos3, 3, suffixes, spos+6, 3) ||

! word.compare( pos3+l, 2, suffixes, spos+2, 2 ) ||

! word.compare( pos3+l, 2, suffixes, spos+4, 2 ))

return;

string ies( "ies" );

if ( ! word.compare( pos3, 3, ies ))

{

word.replace( pos3, 3, 1, '' );

return;

}

string ses( "ses" );

if ( ! word.compare( pos3, 3, ses ))

{

word.erase( pos3+l, 2 );

return;

}

// 's'