Module: Wapiti::Native

Defined in:
ext/wapiti/native.c

Constant Summary collapse

VERSION =

rb_define_singleton_method(mNative, “wapiti”, wapiti, 1);

rb_str_new2(VERSION)

Class Method Summary collapse

Class Method Details

.labelObject

— Top-Level Utility Methods —



1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
# File 'ext/wapiti/native.c', line 1189

static VALUE label(VALUE self __attribute__((__unused__)), VALUE rb_options) {
  if (strncmp("Wapiti::Options", rb_obj_classname(rb_options), 15) != 0) {
    rb_raise(cNativeError, "argument must be a native options instance");
  }

  opt_t *options = get_options(rb_options);

  if (options->mode != 1) {
    rb_raise(cNativeError, "invalid options argument: mode should be set to 1 for labelling");
  }

  mdl_t *model = mdl_new(rdr_new(options->maxent));
  model->opt = options;

  dolabel(model);

  mdl_free(model);

  return Qnil;
}