RULEXDB_SEARCH(3)
okay so bestie, you found it β RULEXDB_SEARCH(3), straight out of the Library Functions Manual shelf π . This is the little function that looks at a word and is like "mmm I think I know how you're pronounced, let me check the vibes." Let's get into it π¦
πΈ 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 π
Okay so here's the tea π. rulexdb_search() goes digging in the database that the rulexdb argument points at, and it tries to guess the pronunciation of the word you handed it through the string that key points to β based on whatever info it managed to acquire. The resulting string gets placed into the buffer that value points to. Heads up though: that buffer must already have enough space for it, because nobody here is checking for you π.
And when it finds absolutely no useful info? It just copies your original word into the value buffer and returns RULEXDB_SPECIAL. Like, "no thoughts, here's your word back" π.
Here's the whole journey, step by step, because the way this thing works is lowkey iconic π:
- First up, the search happens in the Explicit dictionary. If that succeeds, the result is returned and the procedure exits successfully. Slay.
- If not, the word gets treated as an implicit form, and the program tries to guess its base and find it in the Implicit dictionary. If that works, the pronunciation string is constructed from the acquired data and the procedure exits successfully. Ate. π
- Last resort: the word gets matched against general rules. If no match succeeds, the program exits with
RULEXDB_SPECIAL, returning your original word as the result.
And if this whole process turns out to be not fully unsuccessful β meaning some info was found in the database β then the resulting string gets matched against correction rules, and the first matched one is applied, if there is any. Little finishing touch, you know? β¨
Now, that last argument? It decides which steps of the whole saga actually get performed. It's made of these flags, which you can bitwise-or together to build the search mode you want π§:
RULEXDB_EXCEPTIONSβ search the word in the exceptions dictionary.RULEXDB_FORMSβ try to treat the specified word as an implicit form.RULEXDB_RULESβ try to apply general rules.
And a zero value (no flags at all) means the full search (all stages) should be performed. So like, no flags = main character energy, do everything π.
β RETURN VALUE β
rulexdb_search() returns RULEXDB_SUCCESS, which is zero, upon success. If the specified word was not found, you get a positive value: RULEXDB_SPECIAL. And if something is wrong, you get a negative error code π.
π ERRORS π
RULEXDB_FAILUREβ the referenced database has not been opened, internal data structures are corrupted, or some other general failure has occurred. It's giving "everything is on fire" π₯.RULEXDB_EMALLOCβ internal memory allocation error. The malloc said no π«Ά.RULEXDB_EINVKEYβ invalid key specified. That key is not it, bestie.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)
Go read the whole friend group, they're all connected, iykyk π
π«Ά AUTHOR π«Ά
Igor B. Poretsky <poretsky@mlbox.ru> β thank you for your service, king π
and that's the whole page, bestie β¨ this one's from February 20, 2012, and it lives under RULEXDB_SEARCH(3) β now go forth and search those words, no cap π
π¦ where this page comes from
- debian trixie: librulexdb-dev 3.8.6-1 Β· LGPL-2.1-or-later
- ubuntu questing: librulexdb-dev 3.8.6-1
- ubuntu resolute: librulexdb-dev 3.8.6-1build1 Β· LGPL-2.1-or-later
- ubuntu stonking: librulexdb-dev 3.8.6-1build1 Β· LGPL-2.1-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms