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.
Inheritance
Inherited Members
Namespace: SprutTechnology.SCPostprocessor
Assembly: SCPostprocessor.dll
Syntax
public class TransliterationTable
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
Item[Int32]
Returns the character pair by index [0..(Length-1)].
Declaration
public TranslitPair this[int index] { get; }
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | 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 |
---|---|
System.Int32 |
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 |
---|---|---|
System.String | original | The original (natinal) character to be transliterated. |
System.String | replacing | The resulting english character (or few characters) which replaces the original. |
DeletePair(Int32)
Deletes the pair with specified index from the table.
Declaration
public void DeletePair(int index)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | 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 |
---|---|---|
System.String | original | The original character to search. |
System.String | replacing | The replacing character to search. |
Returns
Type | Description |
---|---|
System.Int32 | 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 |
---|---|---|
System.String | original | The original character to search. |
Returns
Type | Description |
---|---|
System.Int32 | 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 |
---|---|---|
System.String | replacing | The replacing character to search. |
Returns
Type | Description |
---|---|
System.Int32 | Returns the index of the found pair. If there is no such pair in the table the result is "-1". |
InsertPair(Int32, 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 |
---|---|---|
System.Int32 | toIndex | The index in the table the new pair should add. |
System.String | original | The original (natinal) character to be transliterated. |
System.String | replacing | The resulting english character (or few characters) which replaces the original. |