RULEXDB_SEARCH(3)

NAME
rulexdb_search - search rulex database for specified word

SYNOPSIS
#include <rulexdb.h>

int rulexdb_search(RULEXDB *rulexdb, const char *key, char *value, int flags);

DESCRIPTION
The rulexdb_search() function searches the database referenced by rulexdb argument and tries to guess pronunciation for the word specified by string pointed by key argument according to the acquired info. The resulting string is
 placed into the buffer pointed by value argument. This buffer must have enough space for it. When no useful
 info is found, the original word is copied to the value buffer and RULEXDB_SPECIAL code is returned.

At first search is performed in the Explicit dictionary. If it
 succeeds, the result is returned and procedure exits
 successfully. Otherwise the word is treated as an implicit form and
 program tries to guess its base and find it in the Implicit
 dictionary. If this process succeeds, the pronunciation string is
 constructed according to the acquired data and procedure exits
 successfully. At last, the word is matched against general rules. If
 no match succeeds, then program exits with RULEXDB_SPECIAL code, returning the original word as a result.

If this process appears to be not fully unsuccessful and some information was found in the database, then the resulting string is matched against correction rules and the first matched one is applied if any.

The last argument specifies which steps of the described process are to be performed. It consists of the following flags which may be bitwise-or'd to form wanted search mode:

RULEXDB_EXCEPTIONS
    Search the word in the exceptions dictionary.

RULEXDB_FORMS
    Try to treat specified word as an implicit form.

RULEXDB_RULES
    Try to apply general rules.

Zero value (no flags) means that full search (all stages) should be
    performed.

RETURN VALUE
The rulexdb_search() function returns RULEXDB_SUCCESS which is zero upon success, positive value RULEXDB_SPECIAL when specified word was not found, or negative error code if something is wrong.

ERRORS

RULEXDB_FAILURE
    Referenced database has not been opened, internal data structures are corrupted or some other general failure has occurred.

RULEXDB_EMALLOC
    Internal memory allocation error.

RULEXDB_EINVKEY
    Invalid key specified.

RULEXDB_EPARM
    Invalid parameters are specified.

SEE ALSO
rulexdb_classify(3), rulexdb_close(3), rulexdb_dataset_name(3), rulexdb_discard_dictionary(3), rulexdb_discard_ruleset(3), rulexdb_fetch_rule(3), rulexdb_lexbase(3), rulexdb_load_ruleset(3), rulexdb_open(3), rulexdb_remove_item(3), rulexdb_remove_rule(3), rulexdb_remove_this_item(3), rulexdb_retrieve_item(3), rulexdb_seq(3), rulexdb_subscribe_item(3), rulexdb_subscribe_rule(3)

AUTHOR
Igor B. Poretsky <poretsky@mlbox.ru>.