void TreeScorerBoundVariables::AddVariable( const lem::UCString & upper_name, const Solarix::Word_Form * wordform )
{
 LEM_CHECKIT_Z( !upper_name.empty() );
 LEM_CHECKIT_Z( wordform!=NULL );

 bound_variables[ upper_name ] = wordform;
 return;
}
Пример #2
0
const lem::CString lem::to_ascii( const lem::UCString &str, const CodeConverter *cp )
{
 if( str.empty() )
  return CString();

 lem::CString ascii;
 lem_unicode_to_ascii( ascii.ptr(), str.c_str(), cp ? cp : &lem::UI::get_UI().GetSessionCp() );
 ascii.ptr()[str.length()] = 0;
 ascii.calc_hash();
 return ascii;
}
Пример #3
0
int Lemmatizator::MatchSuffix( const lem::UCString & suffix ) const
{
 LEM_CHECKIT_Z( !suffix.empty() );

 int id = -1;

 std::map<lem::UCString,int>::const_iterator it = suffix2id.find(suffix);
 if( it!=suffix2id.end() )
  id = it->second;

 return id;
}
Пример #4
0
lem::UCString Lemmatizator::GetSuffix( const lem::UCString & word ) const
{
 LEM_CHECKIT_Z( !word.empty() );

 lem::UCString uword(word);
 uword.to_lower();

 if( word.length()==7 && uword==L"~~end~~" )
  return word;
 else if( word.length()==9 && uword==L"~~begin~~" )
  return word;
 else if( word.length()<=model_suffix_len )
  return uword;
 else
  return lem::UCString(L'~')+lem::right( uword, model_suffix_len );
}