TrackerLanguage
3
LIBTRACKER-COMMON Library

# TrackerLanguage

## Synopsis

                        TrackerLanguage;
    TrackerLanguage *   tracker_language_new                (const gchar *language_code);
    gboolean            tracker_language_get_enable_stemmer (TrackerLanguage *language);
    GHashTable *        tracker_language_get_stop_words     (TrackerLanguage *language);
    const gchar *       tracker_language_get_language_code  (TrackerLanguage *language);
    void                tracker_language_set_enable_stemmer (TrackerLanguage *language,
                                                             gboolean value);
    void                tracker_language_set_language_code  (TrackerLanguage *language,
                                                             const gchar *language_code);
    gchar *             tracker_language_stem_word          (TrackerLanguage *language,
                                                             const gchar *word,
                                                             gint word_length);
    gboolean            tracker_language_check_exists       (const gchar *language_code);
    gchar *             tracker_language_get_default_code   (void);
    GSList *            tracker_language_get_all_by_code    (void);
    const gchar *       tracker_language_get_name_by_code   (const gchar *language_code);
    const gchar *       tracker_language_get_code_by_name   (const gchar *langauge_name);

## Object Hierarchy

      GObject
       +----TrackerLanguage

## Properties

      "enable-stemmer"           gboolean              : Write / Construct
      "language-code"            gchar*                : Write / Construct
      "stop-words"               GHashTable*           : Read

## Description

## Details

### TrackerLanguage

    typedef struct _TrackerLanguage TrackerLanguage;

### tracker_language_new ()

    TrackerLanguage *   tracker_language_new                (const gchar *language_code);

Creates a new TrackerLanguage instance for the passed language code.

`language_code` :

  language code in ISO 639-1 format

Returns :

  a newly created TrackerLanguage

### tracker_language_get_enable_stemmer ()

    gboolean            tracker_language_get_enable_stemmer (TrackerLanguage *language);

Returns whether words stemming is enabled for `language`.

`language` :

  a TrackerLanguage

Returns :

  `TRUE` if word stemming is enabled.

### tracker_language_get_stop_words ()

    GHashTable *        tracker_language_get_stop_words     (TrackerLanguage *language);

Returns the stop words for `language`. Stop words are really common words that are not worth to index for the language handled by `language`.

`language` :

  a TrackerLanguage

Returns :

  A GHashTable with the stop words as the value, this memory is owned by `language` and should not be modified nor freed.

### tracker_language_get_language_code ()

    const gchar *       tracker_language_get_language_code  (TrackerLanguage *language);

Returns the language code in ISO 639-1 handled by `language`.

`language` :

  a TrackerLanguage

Returns :

  the language code.

### tracker_language_set_enable_stemmer ()

    void                tracker_language_set_enable_stemmer (TrackerLanguage *language,
                                                             gboolean value);

Enables or disables word stemming for `language`.

`language` :

  a TrackerLanguage

`value` :

  `TRUE` to enable word stemming

### tracker_language_set_language_code ()

    void                tracker_language_set_language_code  (TrackerLanguage *language,
                                                             const gchar *language_code);

Sets the `language` to `value`, a `NULL` value will reset this to "en" (English).

`language` :

  a TrackerLanguage

`language_code` :

### tracker_language_stem_word ()

    gchar *             tracker_language_stem_word          (TrackerLanguage *language,
                                                             const gchar *word,
                                                             gint word_length);

If the stemmer is enabled, it will return the stem word for `word`. If it's disabled, it will return the passed word.

`language` :

  a TrackerLanguage

`word` :

  string pointing to a word

`word_length` :

  word ascii length

Returns :

  a string with the processed word. This string must be freed with `g_free()`

### tracker_language_check_exists ()

    gboolean            tracker_language_check_exists       (const gchar *language_code);

Checks whether the language is supported by TrackerLanguage

`language_code` :

  language code in ISO 639-1 format

Returns :

  `TRUE` if the language is supported.

### tracker_language_get_default_code ()

    gchar *             tracker_language_get_default_code   (void);

Returns the ISO 639-1 language code for the current locale settings. As a fallback it will return the english language code.

Returns :

  ISO 639-1 language code for the default settings. This string must be freed with `g_free()`.

### tracker_language_get_all_by_code ()

    GSList *            tracker_language_get_all_by_code    (void);

Returns all supported languages by TrackerLanguage

Returns :

  a list of ISO 639-1 language codes. This list must be freed through `g_list_free()`.

### tracker_language_get_name_by_code ()

    const gchar *       tracker_language_get_name_by_code   (const gchar *language_code);

Returns a human readable language name for the given ISO 639-1 code, if supported by TrackerLanguage

`language_code` :

  a ISO 639-1 language code.

Returns :

  the language name.

### tracker_language_get_code_by_name ()

    const gchar *       tracker_language_get_code_by_name   (const gchar *langauge_name);

Supported `language_name` strings and their ISO 639-1 codes include:

- "Danish" (da) - "Dutch" (nl) - "English" (en) - "Finnish" (fi) - "French" (fr) - "German" (de) - "Hungarian" (hu) - "Italian" (it) - "Norwegian" (nb) - "Portuguese" (pt) - "Russian" (ru) - "Spanish" (es) - "Swedish" (sv)

`langauge_name` :

Returns :

  the ISO 639-1 code corresponding to the `language_name`, if it is supported.

## Property Details

### The `"enable-stemmer"` property

      "enable-stemmer"           gboolean              : Write / Construct

Enable stemmer.

Default value: TRUE

### The `"language-code"` property

      "language-code"            gchar*                : Write / Construct

Language code.

Default value: "en"

### The `"stop-words"` property

      "stop-words"               GHashTable*           : Read

Stop words.