Dee ICU Extensions

Dee ICU Extensions — A suite of DeeTermFilters based on ICU

Synopsis

#include <dee-icu.h>

#define             DEE_ICU_ERROR
enum                DeeICUError;
                    DeeICUTermFilter;
GQuark              dee_icu_error_quark                 (void);
gchar *             dee_icu_term_filter_apply           (DeeICUTermFilter *self,
                                                         const gchar *text);
void                dee_icu_term_filter_destroy         (DeeICUTermFilter *filter);
DeeICUTermFilter *  dee_icu_term_filter_new             (const gchar *system_id,
                                                         const gchar *rules,
                                                         GError **error);
DeeICUTermFilter *  dee_icu_term_filter_new_ascii_folder
                                                        ();

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.

Details

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

typedef enum {
  DEE_ICU_ERROR_BAD_RULE,
  DEE_ICU_ERROR_BAD_ID,
  DEE_ICU_ERROR_UNKNOWN
} 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

DEE_ICU_ERROR_BAD_RULE

DEE_ICU_ERROR_BAD_ID

DEE_ICU_ERROR_UNKNOWN


DeeICUTermFilter

typedef struct _DeeICUTermFilter DeeICUTermFilter;


dee_icu_error_quark ()

GQuark              dee_icu_error_quark                 (void);


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.

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.

filter :

The filter to free

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.

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]