RULEXDB_OPEN(3)
π RULEXDB_OPEN(3) π
okay bestie, sit down, hydrate, and let me tell you about rulexdb_open β she opens (or literally creates) a rulex database. it's giving gatekeeper energy, but the helpful kind. this is from the Library Functions Manual, and yes, we're doing this properly. π
β¨ NAME β¨
rulexdb_open β open or create a rulex database. that's the whole job. she's an opener. she opens. π
πΈ SYNOPSIS πΈ
#include <rulexdb.h>
RULEXDB *rulexdb_open(const char *path, int mode);
look at her. two args. no drama. we love a minimal queen. π
π¦ DESCRIPTION π¦
so like, rulexdb_open() opens the rulex database living in the file whose name is the string pointed to by path, and then β and this is the part people forget β she allocates and initializes all the necessary internal data structures associated with it. not just opens. she builds the whole vibe around it. no cap. β¨
the mode argument specifies a database access mode. she may accept one of these three, and fr fr you have to pick one:
RULEXDB_SEARCHβ open the database only for searching. read only mode, bestie. look but don't touch. π«ΆRULEXDB_UPDATEβ open an existing database for searching and updating. read and write mode. she's flexible. πRULEXDB_CREATEβ create a new database and open it for updating and searching. brand new baby, main character energy, born ready. π
π§ DATABASE STRUCTURE π§
okay this is the lore section, get comfy. π
the rulex database consists of two dictionaries and four sets of rules. yes, six things. count them.
the Explicit dictionary contains the words that are described individually and do not imply any information for other forms. this dictionary is looked up first if the search includes this stage.
the Implicit dictionary contains words in some basic form. this one is used to construct the pronunciation string for various forms of these words. and how do we guess the basic form of a word? according to the rules from the Classifiers and Prefix detectors rulesets. that's the second stage of the search process. iykyk.
if these stages do not bring a result, or are not performed, the rules from the General ruleset are used to guess the stressing word. and if no one of these rules can be applied, then no guessing is made and the search process fails. π rip.
externally, all the data are represented textually. for the Russian letters the koi8-r character set is used, and only lower case is allowed. lowercase only. don't test her. β
each dictionary record consists of two fields:
- the first field contains the Russian word that serves as a key when searching. only lowercase Russian letters are allowed here. that's the rule, periodt.
- the second field provides the pronunciation string for this word. the pronunciation string is the word itself, but written in such a manner as it should be pronounced.
there are three additional symbols allowed in the pronunciation string, along with the lowercase Russian letters:
- the
+sign can be used to point the stressed letter. it should be placed just after that letter. - the
=sign is used in some cases just in the same manner, to point so-called weak stress. - the
-sign can serve as a separator in some complex words.
all other symbols are treated as illegal. hard pass, don't do it. π
there are four rulesets in the database: General rules, Classifiers, Prefix detectors and Correctors. externally all these rules are represented by records consisting of one or two fields. the first field always contains a regular expression which is matched against the word to make a decision whether this rule can be applied. always. every time. π
General rules β the only task is to guess stress in the words when dictionary lookup fails. the rules are tried sequentially until match or the list exhaustion. if the match succeeds, then the + sign is inserted into the word right after the first subexpression match to point the stressing position. these rules do not contain a second field. one-field girlies. π
Classifiers β for each rule, it's checked one by one until a match occurs. then the part from the beginning of the word through to the end of the first subexpression match is extracted, and if a second field is present it is appended to the extracted part as a suffix. the resulting string is treated as a basic form of the word, so it is looked up in the Implicit dictionary. if nothing is found, the process continues until the ruleset will be exceeded. keep going, bestie. π₯
Prefix detectors β when nothing is found in the database for a word in its original form, prefix detection rules are applied to it sequentially until a match occurs. the matched prefix is stripped and replaced by the replacement string, if any. then the result word is searched in the Implicit dictionary. in the case of success, the original prefix is restored in the pronunciation string. the comeback. iconic. π
Correctors β these rules are applied to the pronunciation strings instead of the original words. the second field in these rules specifies a regular replacement string where digits serve as subexpression numbers. numbers, not vibes. π’
β RETURN VALUE β
upon successful completion, rulexdb_open() returns a RULEXDB pointer that should be used in other database access functions for referencing the database. hold onto that pointer like it's your iced coffee. β
otherwise, NULL is returned. and you'll know. π
π« SEE ALSO π«
the whole squad, fr fr:
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_remove_item(3)rulexdb_remove_rule(3)rulexdb_remove_this_item(3)rulexdb_retrieve_item(3)rulexdb_search(3)rulexdb_seq(3)rulexdb_subscribe_item(3)rulexdb_subscribe_rule(3)
π AUTHOR π
Igor B. Poretsky <poretsky@mlbox.ru>. the legend herself. bow. πββοΈ
and that's the page, bestie! π this whole thing is from February 19, 2012, and it's page RULEXDB_OPEN(3) β so go forth, open that database, and slay. mwah. π β¨π¦
π¦ 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