Unicode.IndicConjunctBreak (Unicode v2.0.0)

Copy Markdown View Source

Functions to introspect the Unicode Indic conjunct break property for binaries (Strings) and codepoints.

The primary API is indic_conjunct_break/1 which returns the Indic conjunct break property for a codepoint or the list of Indic conjunct break properties for a string.

The functions fetch/1, get/1 and count/1 provide introspection of the codepoint ranges associated with a given Indic conjunct break property. indic_conjunct_break/0, known_indic_conjunct_breaks/0 and aliases/0 return the underlying property data.

Summary

Functions

Returns a map of aliases for Unicode Indic conjunct breaks.

Returns the count of the number of characters for a given Indic conjunct break.

Returns the Unicode codepoint ranges for a given Indic conjunct break.

Returns the Unicode codepoint ranges for a given Indic conjunct break.

Returns the map of Unicode Indic conjunct breaks.

Returns the Indic conjunct break name(s) for the given binary or codepoint.

Returns a list of known Unicode Indic conjunct break names.

Functions

aliases()

Returns a map of aliases for Unicode Indic conjunct breaks.

An alias is an alternative name for referring to an Indic conjunct break. Aliases are resolved by the fetch/1 and get/1 functions.

Returns

  • A map with the alias as a string key and the Indic conjunct break name as an atom value.

Examples

iex> Unicode.IndicConjunctBreak.aliases() |> Map.get("linker")
:linker

count(indic_conjunct_break)

Returns the count of the number of characters for a given Indic conjunct break.

Arguments

  • indic_conjunct_break is any Indic conjunct break name as an atom, or a string alias for an Indic conjunct break.

Returns

  • The number of codepoints that have the given Indic conjunct break.

  • :error if the Indic conjunct break name is not known.

Examples

iex> Unicode.IndicConjunctBreak.count(:linker)
20

fetch(indic_conjunct_break)

Returns the Unicode codepoint ranges for a given Indic conjunct break.

Aliases are resolved by this function.

Arguments

  • indic_conjunct_break is any Indic conjunct break name as an atom, or a string alias for an Indic conjunct break.

Returns

  • {:ok, range_list} where range_list is a list of codepoint ranges as 2-tuples.

  • :error if the Indic conjunct break name is not known.

Examples

iex> {:ok, ranges} = Unicode.IndicConjunctBreak.fetch(:linker)
iex> Enum.take(ranges, 2)
[{2381, 2381}, {2509, 2509}]

iex> Unicode.IndicConjunctBreak.fetch(:invalid)
:error

get(indic_conjunct_break)

Returns the Unicode codepoint ranges for a given Indic conjunct break.

Aliases are resolved by this function.

Arguments

  • indic_conjunct_break is any Indic conjunct break name as an atom, or a string alias for an Indic conjunct break.

Returns

  • range_list which is a list of codepoint ranges as 2-tuples.

  • nil if the Indic conjunct break name is not known.

Examples

iex> Unicode.IndicConjunctBreak.get(:linker) |> Enum.take(2)
[{2381, 2381}, {2509, 2509}]

iex> Unicode.IndicConjunctBreak.get(:invalid)
nil

indic_conjunct_break()

Returns the map of Unicode Indic conjunct breaks.

Returns

  • A map with the Indic conjunct break name as the key and a list of codepoint ranges as 2-tuples as the value.

Examples

iex> Unicode.IndicConjunctBreak.indic_conjunct_break() |> Map.keys() |> Enum.sort()
[:consonant, :extend, :linker]

indic_conjunct_break(string)

Returns the Indic conjunct break name(s) for the given binary or codepoint.

Arguments

  • codepoint_or_string is either an integer codepoint or a string.

Returns

  • In the case of a codepoint, a single Indic conjunct break name as an atom. Codepoints with no explicit Indic conjunct break property default to :none.

  • In the case of a string, a list of the distinct Indic conjunct break names represented by the codepoints in the string.

Examples

iex> Unicode.IndicConjunctBreak.indic_conjunct_break(0x094D)
:linker

iex> Unicode.IndicConjunctBreak.indic_conjunct_break(?A)
:none

known_indic_conjunct_breaks()

Returns a list of known Unicode Indic conjunct break names.

This function does not return the names of any Indic conjunct break aliases.

Returns

  • A list of Indic conjunct break names as atoms.

Examples

iex> Unicode.IndicConjunctBreak.known_indic_conjunct_breaks() |> Enum.sort()
[:consonant, :extend, :linker]