mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-11 13:46:43 +00:00
81 lines
1.3 KiB
C++
81 lines
1.3 KiB
C++
|
/**
|
||
|
* \file Thesaurus.C
|
||
|
* Copyright 2001 the LyX Team
|
||
|
* Read the file COPYING
|
||
|
*
|
||
|
* \author John Levon
|
||
|
*/
|
||
|
|
||
|
#include "Thesaurus.h"
|
||
|
|
||
|
Thesaurus thesaurus;
|
||
|
|
||
|
#ifdef HAVE_LIBAIKSAURUS
|
||
|
|
||
|
Thesaurus::ThesaurusEntry::ThesaurusEntry(string const & ent, char part)
|
||
|
: entry(ent), pos(Thesaurus::NONE)
|
||
|
{
|
||
|
if (part & AikSaurus::Unknown) pos |= OTHER;
|
||
|
if (part & AikSaurus::Other) pos |= OTHER;
|
||
|
if (part & AikSaurus::Noun) pos |= NOUN;
|
||
|
if (part & AikSaurus::Verb) pos |= VERB;
|
||
|
if (part & AikSaurus::Adjective) pos |= ADJECTIVE;
|
||
|
if (part & AikSaurus::Adverb) pos |= ADVERB;
|
||
|
}
|
||
|
|
||
|
|
||
|
Thesaurus::Thesaurus()
|
||
|
{
|
||
|
aik_ = new AikSaurus();
|
||
|
}
|
||
|
|
||
|
|
||
|
Thesaurus::~Thesaurus()
|
||
|
{
|
||
|
delete aik_;
|
||
|
}
|
||
|
|
||
|
|
||
|
std::vector<Thesaurus::ThesaurusEntry> Thesaurus::lookup(string const & text)
|
||
|
{
|
||
|
std::vector<ThesaurusEntry> entries;
|
||
|
|
||
|
if (!aik_->find(text.c_str()))
|
||
|
return entries;
|
||
|
|
||
|
char pos;
|
||
|
string ret;
|
||
|
|
||
|
ret = aik_->next(pos);
|
||
|
while (!ret.empty()) {
|
||
|
entries.push_back(ThesaurusEntry(ret, pos));
|
||
|
ret = aik_->next(pos);
|
||
|
}
|
||
|
|
||
|
return entries;
|
||
|
}
|
||
|
|
||
|
#else
|
||
|
|
||
|
Thesaurus::ThesaurusEntry::ThesaurusEntry(string const &, char)
|
||
|
{
|
||
|
}
|
||
|
|
||
|
|
||
|
Thesaurus::Thesaurus()
|
||
|
{
|
||
|
}
|
||
|
|
||
|
|
||
|
Thesaurus::~Thesaurus()
|
||
|
{
|
||
|
}
|
||
|
|
||
|
|
||
|
std::vector<Thesaurus::ThesaurusEntry> Thesaurus::lookup(string const & text)
|
||
|
{
|
||
|
return std::vector<ThesaurusEntry>();
|
||
|
}
|
||
|
|
||
|
#endif // HAVE_LIBAIKSAURUS
|