Latinizer v0.4.0 Latinizer.Transcriptions View Source

A module storing character mappings used for transcription (i.e. map containing anything that’s not a diacritical sign).

Link to this section Summary

Functions

Returns all of the character mappings as a single transcription map

Returns a submap of the original transcription map containing only the specified characters’ mapping to their latin equivalents

Transcribes specified string

Link to this section Functions

Link to this function get_map() View Source
get_map() :: map()

Returns all of the character mappings as a single transcription map.

Examples

iex> Latinizer.Transcriptions.get_map |> Enum.take(5) |> Map.new
%{"ĸ" => "k", "œ" => "oe", "Ф" => "F", "ч" => "ch", "ш" => "sh"}

iex> Latinizer.Transcriptions.get_map |> Map.size
113
Link to this function get_map(chars) View Source
get_map([binary()]) :: map()

Returns a submap of the original transcription map containing only the specified characters’ mapping to their latin equivalents.

Examples

iex> Latinizer.Transcriptions.get_map ["ł"]
%{"ł" => "l"}

iex> Latinizer.Transcriptions.get_map ["ł", "ó", "Ą"]
%{"ł" => "l"}

iex> Latinizer.Transcriptions.get_map ["ф", "Ш", "ö", "ij", "ŋ"]
%{"ö" => "oe", "ij" => "ij", "ŋ" => "n",
  "Ш" => "SH", "ф" => "f"}
Link to this function transcribe(string, opts \\ []) View Source
transcribe(binary(), list()) :: binary()

Transcribes specified string.

Examples

iex> Latinizer.Transcriptions.transcribe "łata"
"lata"

iex> Latinizer.Transcriptions.transcribe "Русский"
"Russkiy"

iex> Latinizer.Transcriptions.transcribe "Во многих странах мира русский язык включается в программу среднего и высшего образования как иностранный язык."
"Vo mnogih stranah mira russkiy yazyk vklyuchaetsya v programmu srednego i vysshego obrazovaniya kak inostrannyy yazyk."

You can also pass the :only flag to transcribe only the specified characters:

iex(4)> Latinizer.Transcriptions.transcribe "многих", only: ["м", "н", "о", "г", "и", "х"]
"mnogih"

iex(4)> Latinizer.Transcriptions.transcribe "многих", only: ["м", "н", "о"]
"mnoгих"