Dee ICU Extensions

Dee ICU Extensions — A suite of DeeTermFilters based on ICU

Functions

Types and Values

Includes

#include <dee-icu.h>

Description

This module allows developers to easily construct powerful DeeTermFilters with ease. The filters leverage the ICU framework to provide world class transliteration features.

The filters can be employed manually by calling dee_icu_term_filter_apply() or installed in a DeeAnalyzer by calling dee_analyzer_add_term_filter() passing the term filter instance as the user data and dee_icu_term_filter_destroy() as the GDestroyNotify.

Functions

dee_icu_term_filter_new ()

DeeICUTermFilter *
dee_icu_term_filter_new (const gchar *system_id,
                         const gchar *rules,
                         GError **error);

Create a new DeeICUTermFilter for a given ICU transliterator system id and/or set of transliteration rules.

Parameters

system_id

A system id for the transliterator to use. See userguide.icu-project.org/transforms/general

 

rules

A set of transliteration rules to use. See userguide.icu-project.org/transforms/general/rules.

[allow-none]

error

A place to return a GError, or NULL to ignore errors.

[allow-none][error-domains Dee.ICUError]

Returns

A newly allocated DeeICUTermFilter. Free with dee_icu_term_filter_destroy().

[transfer full]


dee_icu_term_filter_new_ascii_folder ()

DeeICUTermFilter *
dee_icu_term_filter_new_ascii_folder ();

Construct a term filter that folds any UTF-8 string into ASCII.

Returns

A newly allocated DeeICUTermFilter. Free with dee_icu_term_filter_destroy().

[transfer full]


dee_icu_term_filter_apply ()

gchar *
dee_icu_term_filter_apply (DeeICUTermFilter *self,
                           const gchar *text);

Apply a DeeICUTermFilter on a piece of UTF-8 text.

Parameters

self

The filter to apply

 

text

The text to apply the filter on

 

Returns

A newly allocated string. Free with g_free().

[transfer full]


dee_icu_term_filter_destroy ()

void
dee_icu_term_filter_destroy (DeeICUTermFilter *filter);

Free all resources allocated by a DeeICUTermFilter.

Parameters

filter

The filter to free

 

dee_icu_error_quark ()

GQuark
dee_icu_error_quark (void);

Types and Values

DEE_ICU_ERROR

#define DEE_ICU_ERROR dee_icu_error_quark()

Error domain for the ICU extension to Dee. Error codes will be from the DeeICUError enumeration


enum DeeICUError

Error codes for the ICU extension to Dee. These codes will be set when the error domain is DEE_ICU_ERROR.

DEE_ICU_ERROR_BAD_RULE : Error parsing a transliteration rule DEE_ICU_ERROR_BAD_ID : Error parsing a transliterator system id DEE_ICU_ERROR_UNKNOWN : The ICU subsystem returned an error that is not handled in Dee

Members

DEE_ICU_ERROR_BAD_RULE

   

DEE_ICU_ERROR_BAD_ID

   

DEE_ICU_ERROR_UNKNOWN

   

DeeICUTermFilter

typedef struct _DeeICUTermFilter DeeICUTermFilter;