当前位置: 首页>>代码示例>>Python>>正文


Python Model.load_from_file方法代码示例

本文整理汇总了Python中model.Model.load_from_file方法的典型用法代码示例。如果您正苦于以下问题:Python Model.load_from_file方法的具体用法?Python Model.load_from_file怎么用?Python Model.load_from_file使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在model.Model的用法示例。


在下文中一共展示了Model.load_from_file方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: __init__

# 需要导入模块: from model import Model [as 别名]
# 或者: from model.Model import load_from_file [as 别名]
    def __init__(self, config):
        """\
        Initialize the object with the given configuration.

        Configuration items (in a hash):

        model_file: path to a lib.model.Model in a pickle to be used for
                    classification
        """
        # TODO handle features config (now dummy, preset for English)
        self.__model_file = config['model_file']
        self.__model = Model.load_from_file(self.__model_file)
开发者ID:ryancotterell,项目名称:flect,代码行数:14,代码来源:flect.py

示例2: install_all_model

# 需要导入模块: from model import Model [as 别名]
# 或者: from model.Model import load_from_file [as 别名]
def install_all_model(models, dirname, fnames):
    '''Load all trained model from filename. Store the result in models. This is a call back for os.path.walk.
    @param models: the resulting model list
    @param dirname: current visiting directory
    @param fnames: all file name int current visiting directory
    @see controler.__init__
    '''
    if dirname == '.':
        return
    for fname in fnames:
        path = os.path.join(dirname, fname)
        if '.' in os.path.basename(path):
            continue
        if os.path.isfile(path):
            name = os.path.basename(path)
            print "Loading model {} ...".format(name)
            model = Model.load_from_file(path)
            models[name] = model
开发者ID:AcademiaSinicaNLPLab,项目名称:emotion_push,代码行数:20,代码来源:controler.py

示例3: __init__

# 需要导入模块: from model import Model [as 别名]
# 或者: from model.Model import load_from_file [as 别名]
    def __init__(self, config):
        """\
        Initialize the object with the given configuration.

        Configuration items (in a hash):

        model_file: path to a lib.model.Model in a pickle to be used for
                    classification
        """
        # load the model
        self.model_file = config['model_file']
        self.model = Model.load_from_file(self.model_file)
        # setup input features
        self.features = config.get('features', 'Lemma|Tag_POS').split('|')
        self.numeric_features = set()
        if 'feature_types' in config:
            feat_types = config['feature_types'].split('|')
            self.numeric_features = set([feat for feat, feat_type in zip(self.features, feat_types)
                                         if feat_type.upper() == 'NUMERIC'])
        self.ctr = 0
开发者ID:UFAL-DSG,项目名称:flect,代码行数:22,代码来源:classif.py


注:本文中的model.Model.load_from_file方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。