comments and test driver changes
--HG-- branch : CASEDIACSENS
This commit is contained in:
parent
9b273d94e8
commit
419ade0352
@ -270,6 +270,7 @@ public:
|
|||||||
#endif
|
#endif
|
||||||
// Got a non-empty sort-of appropriate term, let's send it to
|
// Got a non-empty sort-of appropriate term, let's send it to
|
||||||
// aspell
|
// aspell
|
||||||
|
LOGDEB2(("ASpExecPv: [%s]\n", m_input->c_str()));
|
||||||
m_input->append("\n");
|
m_input->append("\n");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -454,7 +455,8 @@ RclConfig *rclconfig;
|
|||||||
static char usage [] =
|
static char usage [] =
|
||||||
" -b : build dictionary\n"
|
" -b : build dictionary\n"
|
||||||
" -s <term>: suggestions for term\n"
|
" -s <term>: suggestions for term\n"
|
||||||
"\n\n"
|
" -c <term>: check term\n"
|
||||||
|
"\n"
|
||||||
;
|
;
|
||||||
static void
|
static void
|
||||||
Usage(void)
|
Usage(void)
|
||||||
@ -467,6 +469,7 @@ static int op_flags;
|
|||||||
#define OPT_MOINS 0x1
|
#define OPT_MOINS 0x1
|
||||||
#define OPT_s 0x2
|
#define OPT_s 0x2
|
||||||
#define OPT_b 0x4
|
#define OPT_b 0x4
|
||||||
|
#define OPT_c 0x8
|
||||||
|
|
||||||
int main(int argc, char **argv)
|
int main(int argc, char **argv)
|
||||||
{
|
{
|
||||||
@ -483,6 +486,10 @@ int main(int argc, char **argv)
|
|||||||
while (**argv)
|
while (**argv)
|
||||||
switch (*(*argv)++) {
|
switch (*(*argv)++) {
|
||||||
case 'b': op_flags |= OPT_b; break;
|
case 'b': op_flags |= OPT_b; break;
|
||||||
|
case 'c': op_flags |= OPT_c; if (argc < 2) Usage();
|
||||||
|
word = *(++argv);
|
||||||
|
argc--;
|
||||||
|
goto b1;
|
||||||
case 's': op_flags |= OPT_s; if (argc < 2) Usage();
|
case 's': op_flags |= OPT_s; if (argc < 2) Usage();
|
||||||
word = *(++argv);
|
word = *(++argv);
|
||||||
argc--;
|
argc--;
|
||||||
@ -526,6 +533,18 @@ int main(int argc, char **argv)
|
|||||||
cerr << "buildDict failed: " << reason << endl;
|
cerr << "buildDict failed: " << reason << endl;
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
} else if (op_flags & OPT_c) {
|
||||||
|
bool ret = aspell.check(word, reason);
|
||||||
|
if (!ret && reason.size()) {
|
||||||
|
cerr << "Aspell error: " << reason << endl;
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
cout << word;
|
||||||
|
if (ret) {
|
||||||
|
cout << " is in dictionary" << endl;
|
||||||
|
} else {
|
||||||
|
cout << " not in dictionary" << endl;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
list<string> suggs;
|
list<string> suggs;
|
||||||
if (!aspell.suggest(rcldb, word, suggs, reason)) {
|
if (!aspell.suggest(rcldb, word, suggs, reason)) {
|
||||||
|
|||||||
@ -54,7 +54,12 @@ class Aspell {
|
|||||||
* of an indexing pass. */
|
* of an indexing pass. */
|
||||||
bool buildDict(Rcl::Db &db, std::string &reason);
|
bool buildDict(Rcl::Db &db, std::string &reason);
|
||||||
|
|
||||||
/** Check that word is in dictionary. ret==false && !reason.empty() => err*/
|
/** Check that word is in dictionary. Note that this would mean
|
||||||
|
* that the EXACT word is: aspell just does a lookup, no
|
||||||
|
* grammatical, case or diacritics magic of any kind
|
||||||
|
*
|
||||||
|
* @return true if word in dic, false if not. reason.size() -> error
|
||||||
|
*/
|
||||||
bool check(const std::string& term, std::string& reason);
|
bool check(const std::string& term, std::string& reason);
|
||||||
|
|
||||||
/** Return a list of possible expansions for a given word */
|
/** Return a list of possible expansions for a given word */
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user