Home | Trees | Indices | Help |
|
---|
|
Provides an abstract factory for creating ReadingOperators and ReadingConverters and a façade to directly access the methods offered by these classes.
Instances of other classes are cached in the background and reused on later calls for methods accessed through the façade. createReadingOperator() and createReadingConverter can be used to create new instances for use outside of the ReadingFactory.
To Do (Bug): Non standard reading options seem to be accepted when default in converter:
>>> print f.convert('lao3shi1', 'Pinyin', 'MandarinIPA') lau˨˩.ʂʅ˥˥To Do (Impl):
|
|||
SimpleReadingConverterAdaptor Defines a simple converter between two character readings that keeps the real converter doing the work in the background. |
|
|||
|
|||
Inherited from |
|||
Meta | |||
---|---|---|---|
|
|||
list of str |
|
||
classobj |
|
||
instance |
|
||
|
|||
classobj |
|
||
instance |
|
||
bool |
|
||
|
|||
instance |
|
||
instance |
|
||
|
|||
ReadingConverter methods | |||
str |
|
||
list of str |
|
||
ReadingOperator methods | |||
list of str |
|
||
str |
|
||
bool |
|
||
RomanisationOperator methods | |||
list of list of str |
|
||
list of list of str |
|
||
bool |
|
||
set of str |
|
||
TonalRomanisationOperator methods | |||
list |
|
||
str |
|
||
tuple |
|
||
set of str |
|
||
bool |
|
|
|||
Meta | |||
---|---|---|---|
|
|
|||
READING_OPERATORS =
A list of supported reading operators. |
|||
READING_CONVERTERS =
A list of supported reading converters. |
|||
sharedState =
Dictionary holding global state information used by all instances of the ReadingFactory. |
|
|||
Inherited from |
|
Initialises the ReadingFactory. If no parameters are given default values are assumed for the connection to the database. The database connection parameters can be given in databaseUrl, or an instance of DatabaseConnector can be passed in dbConnectInst, the latter one being preferred if both are specified.
Bug: Specifying another database connector overwrites settings of other instances. |
Publishes a ReadingOperator to the list and thus makes it available for other methods in the library.
|
Gets a list of all supported readings.
|
Gets the ReadingOperator's class for the given reading.
|
Creates an instance of a ReadingOperator for the given reading.
|
Publishes a ReadingConverter to the list and thus makes it available for other methods in the library.
|
Gets the ReadingConverter's class for the given source and target reading.
|
Creates an instance of a ReadingConverter for the given source and target reading and returns it wrapped as a SimpleReadingConverterAdaptor. As ReadingConverters generally support more than one conversion direction the user needs to specify which source and target reading is needed on a regular instance. Wrapping the created instance in the adaptor gives a simple convert() and convertEntities() routine, such that on conversion the source and target readings don't have to be specified. Other methods signatures remain unchanged.
|
Checks if the conversion from reading A to reading B is supported.
|
Returns the default options for the ReadingOperator or ReadingConverter applied for the given reading name or names respectively. The keyword 'dbConnectInst' is not regarded a configuration option and is thus not included in the dict returned.
|
Returns an instance of a ReadingOperator for the given reading from the internal cache and creates it if it doesn't exist yet.
To Do (Impl): Get all options when calculating key for an instance and use the information on standard parameters thus minimising instances in cache. Same for _getReadingConverterInstance(). |
Returns an instance of a ReadingConverter for the given source and target reading from the internal cache and creates it if it doesn't exist yet.
To Do (Fix): Reusing of instances for other supported conversion directions isn't that efficient if a special ReadingOperator is specified for one direction, that doesn't affect others. |
Checks for special operators requested for the given source and target reading.
|
Constructs a unique hashable (partially deep-)copy for a given
instance, replacing non-hashable datatypes
|
Converts the given string in the source reading to the given target reading.
|
Converts a list of entities in the source reading to the given target reading.
|
Decomposes the given string into basic entities that can be mapped to one Chinese character each for the given reading. The given input string can contain other non reading characters, e.g. punctuation marks. The returned list contains a mix of basic reading entities and other characters e.g. spaces and punctuation marks.
|
Composes the given list of basic entities to a string for the given reading.
|
Checks if the given string is an entity of the given reading.
|
Decomposes the given string into basic entities that can be mapped to one Chinese character each for ambiguous decompositions. It all possible decompositions. This method is a more general version of decompose(). The returned list construction consists of two entity types: entities of the romanisation and other strings.
|
Takes a string written in the romanisation and returns the possible segmentations as a list of syllables. In contrast to decompose() this method merely segments continuous entities of the romanisation. Characters not part of the romanisation will not be dealt with, this is the task of the more general decompose method.
|
Checks if the given decomposition follows the romanisation format strictly to allow unambiguous decomposition. The romanisation should offer a way/protocol to make an unambiguous decomposition into it's basic syllables possible as to make the process of appending syllables to a string reversible. The testing on compliance with this protocol has to be implemented here. Thus this method can only return true for one and only one possible decomposition for all strings.
|
Gets a set of all entities supported by the reading. The list is used in the segmentation process to find entity boundaries.
|
Returns a set of tones supported by the reading.
|
Gets the entity with tone mark for the given plain entity and tone.
|
Splits the entity into an entity without tone mark (plain entity) and the entity's tone.
|
Gets the list of plain entities supported by this reading. Different to getReadingEntities() the entities will carry no tone mark.
|
Returns true if the given plain entity (without any tone mark) is recognised by the romanisation operator, i.e. it is a valid entity of the reading returned by the segmentation method. Reading entities will be handled as being case insensitive.
|
|
READING_OPERATORSA list of supported reading operators.
|
READING_CONVERTERSA list of supported reading converters.
|
sharedStateDictionary holding global state information used by all instances of the ReadingFactory.
|
Home | Trees | Indices | Help |
|
---|
Generated by Epydoc 3.0.1 on Tue May 19 22:38:35 2009 | http://epydoc.sourceforge.net |