Exemplo n.º 1
0
def test_crf(model_path, test_path, label_path):
    """
    do label use a pre-trained crf model
    :param model_path:
    :param test_path:
    :param label_path:
    :return:
    """
    opt = create_default_opt()
    crf_model = pywapiti.mdl_new(pywapiti.rdr_new(opt.maxent))
    crf_model.opt = opt
    crf_model = load_model(crf_model, model_path)
    do_label(crf_model, test_path, label_path)
Exemplo n.º 2
0
def test_crf(model_path, test_path, label_path):
    """
    do label use a pre-trained crf model
    :param model_path:
    :param test_path:
    :param label_path:
    :return:
    """
    opt = create_default_opt()
    crf_model = pywapiti.mdl_new(
        pywapiti.rdr_new(opt.maxent))
    crf_model.opt = opt
    crf_model = load_model(crf_model, model_path)
    do_label(crf_model, test_path, label_path)
Exemplo n.º 3
0
def train_crf(train_path, pattern_path, model_path):
    """
    train a crf model
    :param train_path:
    :param pattern_path:
    :param model_path:
    :return:
    """
    opt = create_default_opt()
    opt.input = train_path
    opt.pattern = pattern_path
    opt.output = model_path
    opt.maxiter = 10
    opt.nthread = 4

    crf_model = pywapiti.mdl_new(pywapiti.rdr_new(opt.maxent))
    crf_model.opt = opt
    do_train(crf_model)
Exemplo n.º 4
0
def train_crf(train_path, pattern_path, model_path):
    """
    train a crf model
    :param train_path:
    :param pattern_path:
    :param model_path:
    :return:
    """
    opt = create_default_opt()
    opt.input = train_path
    opt.pattern = pattern_path
    opt.output = model_path
    opt.maxiter = 10
    opt.nthread = 4

    crf_model = pywapiti.mdl_new(
        pywapiti.rdr_new(opt.maxent))
    crf_model.opt = opt
    do_train(crf_model)
Exemplo n.º 5
0
 def _init_model(model_path):
     opt = create_default_opt()
     crf_model = pywapiti.mdl_new(pywapiti.rdr_new(opt.maxent))
     crf_model.opt = opt
     crf_model = load_model(crf_model, model_path)
     return crf_model