| Home | Trees | Index | Help |
|
|---|
| Package corebio :: Module seq :: Class Alphabet |
|
object --+
|
Alphabet
An ordered subset of printable ascii characters.
Status:
Beta
Authors:
- GEC 2005
| Method Summary | |
|---|---|
__eq__(self,
other)
| |
__getitem__(self,
key)
| |
__iter__(self)
| |
__len__(self)
| |
__ne__(self,
other)
| |
Create a new, immutable Alphabet. (Static method) | |
__repr__(self)
| |
__str__(self)
| |
True if all characters of the string are in this alphabet. | |
The n'th character in the alphabet (zero indexed) or \0... | |
Convert a sequence of ordinals into an alphabetic string. | |
Letters of the alphabet as a string. | |
Normalize an alphabetic string by converting all alternative symbols to the canonical equivalent in 'letters'. | |
The ordinal position of the character c in this alphabet, or 255 if no such character. | |
Convert an alphabetic string into a byte array of ordinals. | |
| Inherited from object | |
x.__init__(...) initializes x; see x.__class__.__doc__ for signature... | |
x.__delattr__('name') <==> del x.name... | |
x.__getattribute__('name') <==> x.name... | |
x.__hash__() <==> hash(x)... | |
helper for pickle... | |
helper for pickle... | |
x.__setattr__('name', value) <==> x.name = value... | |
| Class Variable Summary | |
|---|---|
list |
__slots__ = ['_letters', '_alternatives', '_ord_table', ...
|
| Instance Method Details |
|---|
alphabetic(self, string)True if all characters of the string are in this alphabet. |
chr(self, n)The n'th character in the alphabet (zero indexed) or \0 |
chrs(self, sequence_of_ints)Convert a sequence of ordinals into an alphabetic string. |
letters(self)Letters of the alphabet as a string. |
normalize(self, string)Normalize an alphabetic string by converting all alternative symbols to the canonical equivalent in 'letters'. |
ord(self, c)The ordinal position of the character c in this alphabet, or 255 if no such character. |
ords(self, string)Convert an alphabetic string into a byte array of ordinals. |
| Static Method Details |
|---|
__new__(cls, letters, alternatives=None)
Create a new, immutable Alphabet.
arguments:
- letters -- the letters in the alphabet. The ordering determines
the ordinal position of each character in this alphabet.
- alt -- A list of (alternative, canonical) letters. The alternatives
are given the same ordinal position as the canonical character.
e.g. (('?','X'),('x', 'X')) states that '?' and 'x' are synomonous
with 'X'. Values that are not in 'letters' are ignored. Alternatives
that are already in 'letters' are also ignored. If the same
alternative character is used twice then the alternative is assigned
to the canonical character that occurs first in 'letters'. The
default is to assume that upper and lower case characters are
equivalent, unless both cases are included in 'letters'.
raises:
ValueError : Repetitive or otherwise illegal set of letters.
|
| Class Variable Details |
|---|
__slots__
|
| Home | Trees | Index | Help |
|
|---|
| Generated by Epydoc 2.1 on | http://epydoc.sf.net |