Class: Libexttextcat::Candidate

Inherits:
Object
  • Object
show all
Defined in:
ext/libexttextcat/libexttextcat.c

Instance Method Summary collapse

Instance Method Details

#nameObject

:call-seq:

name -> String

This can be fragile when the target source is too short; sometimes raise error and sometimes returns garbage data.



211
212
213
214
215
216
217
218
219
# File 'ext/libexttextcat/libexttextcat.c', line 211

static VALUE
rbe_candidate_m_name (VALUE self)
{
  const candidate_t *c = rb_check_typeddata (self, &rbe_candidate_type);
  /* This can happen when classified as short. */
  if (!c->name)
    rb_raise (rbe_eError, "invalid candidate");
  return rb_str_new_cstr (c->name);
}

#scoreObject

:call-seq:

score -> Integer


197
198
199
200
201
202
# File 'ext/libexttextcat/libexttextcat.c', line 197

static VALUE
rbe_candidate_m_score (VALUE self)
{
  const candidate_t *c = rb_check_typeddata (self, &rbe_candidate_type);
  return RB_INT2NUM (c->score);
}