def _load_ngram ( name ) : module = importlib . import_module ( 'lantern.analysis.english_ngrams.{}' . format ( name ) ) return getattr ( module , name )
how to load npy in python
Dynamically import the python module with the ngram defined as a dictionary . Since bigger ngrams are large files its wasteful to always statically import them if they re not used .
def _load_ngram(name):
    """Dynamically import the python module with the ngram defined as a dictionary.
    Since bigger ngrams are large files its wasteful to always statically import them if they're not used.
    """
    module = importlib.import_module('lantern.analysis.english_ngrams.{}'.format(name))
    return getattr(module, name)