Class TransliterationTable
The table which contains the list of string pairs of type TranslitPair for one exact language to be possible to do transliteration of text from this language to english.
You can easily create the new table using the code example below.
Namespace: DotnetPostprocessing.SDK
Assembly: DotnetPostprocessing.SDK.dll
Syntax
public class TransliterationTable : Object
Remarks
myTable = new TransliterationTable(
new TranslitPair[] {
new TranslitPair("а", "a"),
new TranslitPair("б", "b"),
new TranslitPair("в", "v"),
new TranslitPair("г", "g"),
new TranslitPair("д", "d"),
new TranslitPair("е", "e"),
new TranslitPair("ё", "yo"),
new TranslitPair("ж", "zh"),
new TranslitPair("з", "z"),
new TranslitPair("и", "i"),
new TranslitPair("й", "i"),
new TranslitPair("к", "k"),
new TranslitPair("л", "l"),
new TranslitPair("м", "m"),
new TranslitPair("н", "n"),
new TranslitPair("о", "o"),
new TranslitPair("п", "p"),
new TranslitPair("р", "r"),
new TranslitPair("с", "s"),
new TranslitPair("т", "t"),
new TranslitPair("у", "u"),
new TranslitPair("ф", "f"),
new TranslitPair("х", "h"),
new TranslitPair("ц", "c"),
new TranslitPair("ч", "ch"),
new TranslitPair("ш", "sh"),
new TranslitPair("щ", "shh"),
new TranslitPair("ъ", ""),
new TranslitPair("ы", "y"),
new TranslitPair("ь", ""),
new TranslitPair("э", "e"),
new TranslitPair("ю", "yu"),
new TranslitPair("я", "ya")
}
);
Constructors
TransliterationTable()
Initializes a new instance of TransliterationTable.
Declaration
public TransliterationTable()
TransliterationTable(TranslitPair[])
Initializes a new instance of TransliterationTable. Takes as an input an array of character pairs used to replace national characters with English.
Declaration
public TransliterationTable(TranslitPair[] dictionary)
Parameters
| Type | Name | Description |
|---|---|---|
| TranslitPair[] | dictionary | An array of character pairs used to replace national characters with English. |
Properties
this[int]
Returns the character pair by index [0..(Length-1)].
Declaration
public TranslitPair this[int index] { get; }
Parameters
| Type | Name | Description |
|---|---|---|
| int | index | The index [0..(Length-1)] of pair you want to get. |
Property Value
| Type | Description |
|---|---|
| TranslitPair | Returns TranslitPair of the index. It will throw an exception if the index exceeds the range. |
Length
The count of character pairs in the table.
Declaration
public int Length { get; }
Property Value
| Type | Description |
|---|---|
| int |
Methods
AddPair(string, string)
Adds a new transliteration pair to the end of table.
Declaration
public void AddPair(string original, string replacing)
Parameters
| Type | Name | Description |
|---|---|---|
| string | original | The original (natinal) character to be transliterated. |
| string | replacing | The resulting english character (or few characters) which replaces the original. |
DeletePair(int)
Deletes the pair with specified index from the table.
Declaration
public void DeletePair(int index)
Parameters
| Type | Name | Description |
|---|---|---|
| int | index | The index of pair to delete. |
IndexOf(string, string)
Searches the index of a pair in the table.
Declaration
public int IndexOf(string original, string replacing)
Parameters
| Type | Name | Description |
|---|---|---|
| string | original | The original character to search. |
| string | replacing | The replacing character to search. |
Returns
| Type | Description |
|---|---|
| int | Returns the index of the found pair. If there is no such pair in the table the result is "-1". |
IndexOfOriginal(string)
Searches the index of a pair in the table by original character.
Declaration
public int IndexOfOriginal(string original)
Parameters
| Type | Name | Description |
|---|---|---|
| string | original | The original character to search. |
Returns
| Type | Description |
|---|---|
| int | Returns the index of the found pair. If there is no such pair in the table the result is "-1". |
IndexOfReplacing(string)
Searches the index of a pair in the table by replacing character.
Declaration
public int IndexOfReplacing(string replacing)
Parameters
| Type | Name | Description |
|---|---|---|
| string | replacing | The replacing character to search. |
Returns
| Type | Description |
|---|---|
| int | Returns the index of the found pair. If there is no such pair in the table the result is "-1". |
InsertPair(int, string, string)
Inserts a new transliteration pair to specifed position of table. The existing pairs starting from defined index will be moved down.
Declaration
public void InsertPair(int toIndex, string original, string replacing)
Parameters
| Type | Name | Description |
|---|---|---|
| int | toIndex | The index in the table the new pair should add. |
| string | original | The original (natinal) character to be transliterated. |
| string | replacing | The resulting english character (or few characters) which replaces the original. |