trainers/__init__.py

underthesea · underthesea/trainers/__init__.py · python · Apache-2.0
ai

Lazy-loaded trainer classes for the underthesea NLP library, enabling on-demand imports.

# Source: https://github.com/undertheseanlp/underthesea | License: Apache-2.0 | Copyright You must retain, in the Source form of any Derivative Works
# Provided via justclaw.it.com; keep this notice with the code.
# Lazy imports to avoid loading dependencies at import time
def __getattr__(name):
    if name == 'ParserTrainer':
        from underthesea.trainers.parser_trainer import ParserTrainer
        return ParserTrainer
    if name == 'DependencyParserTrainer':
        from underthesea.trainers.dependency_parser_trainer import DependencyParserTrainer
        return DependencyParserTrainer
    if name == 'CRFTrainer':
        from underthesea.trainers.crf_trainer import CRFTrainer
        return CRFTrainer
    if name == 'POSTrainer':
        from underthesea.trainers.pos_trainer import

... (truncated -- full source via MCP)

See the full source, get the GitHub permalink, and search for more like it.

Get a free API key