2001-07-29 10:42:11 +00:00
|
|
|
/**
|
|
|
|
* \file Thesaurus.C
|
|
|
|
* Copyright 2001 the LyX Team
|
|
|
|
* Read the file COPYING
|
|
|
|
*
|
|
|
|
* \author John Levon
|
|
|
|
*/
|
|
|
|
|
2001-12-20 15:11:51 +00:00
|
|
|
#include <config.h>
|
|
|
|
|
2001-07-29 10:42:11 +00:00
|
|
|
#include "Thesaurus.h"
|
|
|
|
|
|
|
|
Thesaurus thesaurus;
|
|
|
|
|
|
|
|
#ifdef HAVE_LIBAIKSAURUS
|
|
|
|
|
|
|
|
Thesaurus::ThesaurusEntry::ThesaurusEntry(string const & ent, char part)
|
|
|
|
: entry(ent), pos(Thesaurus::NONE)
|
|
|
|
{
|
2001-12-10 20:06:59 +00:00
|
|
|
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;
|
2001-07-29 10:42:11 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
Thesaurus::Thesaurus()
|
|
|
|
{
|
2001-12-10 20:06:59 +00:00
|
|
|
aik_ = new AikSaurus;
|
2001-07-29 10:42:11 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
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;
|
|
|
|
|
2001-12-10 20:06:59 +00:00
|
|
|
string ret = aik_->next(pos);
|
2001-07-29 10:42:11 +00:00
|
|
|
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()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2001-08-02 18:46:53 +00:00
|
|
|
std::vector<Thesaurus::ThesaurusEntry>
|
|
|
|
Thesaurus::lookup(string const & /*text*/)
|
2001-07-29 10:42:11 +00:00
|
|
|
{
|
|
|
|
return std::vector<ThesaurusEntry>();
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif // HAVE_LIBAIKSAURUS
|