The Cipher class is used to change between different alphabets
(and so behaves as a simple substitution cipher). The Cipher function
creates a new object of the Cipher class.
The Cipher function returns a new object of the Cipher
class. The encode and decode functions return character
vectors that are the same size as their input text parameters.
Objects from the Class
Objects should be defined using the Cipher constructor. You
typically pass in a character vector of "words" that contain all the
symbols that are contained in the text to be translated (i.e., encoded
and decoded) between languages. A standard target alphabet is created
along with forward and reverse transliteration rules.
Arguments
sampleText
A character vector that contains all symbols you
want to be able to transliterate. Duplicate symbols are
automatically removed.
split
A single character used to split words into
symbols. Defaults to a hyphen for our applications.
extras
Additional characters to be added for reverse
tranlsiteration, since they may appear as the results of
alignments in consensus sequences.
cipher
An object of the Cipher class.
text
A character vector of words to be transliterated.
Slots
forward:
A named character vector.
reverse:
A named character vector.
bytes:
The number of bytes used to encode each
'character' in the input test. Text with more than 72 unique
characters use a two-byte encoding, which is enough for
languages with up to 26*72 = 1872 characters.