---
name: "rulexdb_subscribe_item"
section: "3"
platform: "linux"
package: "librulexdb-dev"
version: "3.8.6-1"
release: "Debian 13 (Trixie)"
platforms: ["linux"]
url: "https://new.carta.tech/rulexdb_subscribe_item"
---

# rulexdb\_subscribe\_item(3)

put new dictionary item into the rulex database

## NAME

rulexdb\_subscribe\_item - put new dictionary item into the rulex database

## SYNOPSIS

```
#include <rulexdb.h>

int rulexdb_subscribe_item(RULEXDB *rulexdb, const char *key, const char *value, int item_type, int overwrite);
```

## DESCRIPTION

The **rulexdb\_subscribe\_item**() function inserts new item into one of the dictionary datasets in the database referenced by *rulexdb* argument.

The argument *key* points to a text string containing the original word.

The argument *value* points to the corresponding pronunciation string.

The argument *item\_type* specifies target dataset. It may accept one of the following values:

- **RULEXDB\_LEXBASE**

  The item represents a lexical base, therefore should be inserted into the **Implicit** dictionary.

- **RULEXDB\_EXCEPTION**

  Explicit item that should be inserted into the **Explicit** dictionary.

- **RULEXDB\_DEFAULT**

  Target dictionary should be guessed according to specified key: if it represents any lexical base, then **Implicit** dictionary will be chosen, otherwise the **Explicit** dictionary will be used. If key word is recognized as a lexical base, but the record for this key already exist in the **Implicit** dictionary, then **Explicit** dictionary will be tried instead.

The argument *overwrite* If true (non-zero) the new item will replace already existing one with the same key if any. Otherwise the new item will not be stored.

## RETURN VALUE

The **rulexdb\_subscribe\_item**() function returns **RULEXDB\_SUCCESS** which is zero when specified item was successfully subscribed, positive value **RULEXDB\_SPECIAL** when specified key already exists in the dictionary, or negative error code otherwise.

## ERRORS

- **RULEXDB\_FAILURE**

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

- **RULEXDB\_EINVKEY**

  Invalid key specified.

- **RULEXDB\_EINVREC**

  Invalid pronunciation string specified.

- **RULEXDB\_EPARM**

  The argument *rulexdb* or *item\_type* has an invalid value.

- **RULEXDB\_EACCESS**

  The database is not opened for updating.

## SEE ALSO

[**rulexdb\_classify**(3)](/rulexdb_classify/3.md), [**rulexdb\_close**(3)](/rulexdb_close/3.md), [**rulexdb\_dataset\_name**(3)](/rulexdb_dataset_name/3.md), [**rulexdb\_discard\_dictionary**(3)](/rulexdb_discard_dictionary/3.md), [**rulexdb\_discard\_ruleset**(3)](/rulexdb_discard_ruleset/3.md), [**rulexdb\_fetch\_rule**(3)](/rulexdb_fetch_rule/3.md), [**rulexdb\_lexbase**(3)](/rulexdb_lexbase/3.md), [**rulexdb\_load\_ruleset**(3)](/rulexdb_load_ruleset/3.md), [**rulexdb\_open**(3)](/rulexdb_open/3.md), [**rulexdb\_remove\_item**(3)](/rulexdb_remove_item/3.md), [**rulexdb\_remove\_rule**(3)](/rulexdb_remove_rule/3.md), [**rulexdb\_remove\_this\_item**(3)](/rulexdb_remove_this_item/3.md), [**rulexdb\_retrieve\_item**(3)](/rulexdb_retrieve_item/3.md), [**rulexdb\_search**(3)](/rulexdb_search/3.md), [**rulexdb\_seq**(3)](/rulexdb_seq/3.md), [**rulexdb\_subscribe\_rule**(3)](/rulexdb_subscribe_rule/3.md)

## AUTHOR

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