MorphologyDB class parses a morphology database file and generates
indexes to be used by the analyzer, generator, and reinflector components.
You will never have to access
MorphologyDB instances directly but only
pass them as arguments when creating new instances of the analyzer, generator,
and reinflector components.
Class providing indexes from a given morphology database file.
- fpath (
str) – File path to database.
- flags (
str) – Flag string (similar to opening files) indicates what components the database will be used for. ‘a’ indicates analysis, ‘g’ indicates generation, and ‘r’ indicates indicates reinflection. ‘r’ is equivalent to ‘ag’ since the reinflector uses both analyzer and generator components internally. Defaults to ‘a’.
InvalidDatabaseFlagError– When an invalid flag value is given.
Return a set of all features provided by this database instance.
Returns: The set all features provided by this database instance. Return type:
MorphologyDBinstance from one of the builtin databases provided.
Instance of builtin database with given flags.
Returns a list of builtin databases provided with CAMeL Tools.
Returns: List of builtin databases. Return type:
- fpath (
Below is a list of databases that ship with CAMeL Tools:
from camel_tools.morphology.database import MorphologyDB # Initialize the default database ('calima-msa-r13') db = MorphologyDB.builtin_db() # In the above call, the database is loaded for analysis only by defaut. # This is equivalent to writing: db = MorphologyDB.builtin_db(flags='a') # We can load it for generation as so: db = MorphologyDB.builtin_db(flags='g') # Or for reinflection as so: db = MorphologyDB.builtin_db(flags='r') # Since reinflection uses the database in both analysis and generation modes # internally, the above is equivalent to writing: db = MorphologyDB.builtin_db(flags='ag') # We can initialize other builtin databases by providing the name of the # desired database. In the examples above, we loaded the default database # 'calima-msa-r13'. We can load other builtin databases by providing the # desired databases name. Here we'll load the builtin Egyptian database, # 'calima-egy-r13': db = MorphologyDB.builtin_db('calima-egy-r13') # Or with flags: db = MorphologyDB.builtin_db('calima-egy-r13', flags='r') # We can also initialize external databases: db = MorphologyDB('/path/to/database') # or with flags: db = MorphologyDB('/path/to/database', flags='g')
|||calima-msa-r13 is a modified version of the almor-msa-r13.db database that ships with MADAMIRA. The calima-msa-r13.db database is distributed under the GNU General Public License version 2.|
|||calima-egy-r13 is a modified version of the almor-cra07.db database that ships with MADAMIRA. The calima-egy-r13.db database is distributed under the GNU General Public License version 2.|