pub struct JsTrainingExample { /* private fields */ }Expand description
A training example for the NSR machine
Implementations§
Source§impl JsTrainingExample
impl JsTrainingExample
pub fn into_reference( val: JsTrainingExample, env: Env, ) -> Result<Reference<JsTrainingExample>>
pub fn into_instance(self, env: Env) -> Result<ClassInstance<JsTrainingExample>>
Source§impl JsTrainingExample
impl JsTrainingExample
Sourcepub fn new(
inputs: Vec<&JsGroundedInput>,
output: &JsSemanticValue,
difficulty: Option<f64>,
) -> Self
pub fn new( inputs: Vec<&JsGroundedInput>, output: &JsSemanticValue, difficulty: Option<f64>, ) -> Self
Create a new training example
Sourcepub fn from_text(text: String, output: &JsSemanticValue) -> Self
pub fn from_text(text: String, output: &JsSemanticValue) -> Self
Create a training example from a single text input
Sourcepub fn from_tokens(tokens: Vec<String>, output: &JsSemanticValue) -> Self
pub fn from_tokens(tokens: Vec<String>, output: &JsSemanticValue) -> Self
Create a training example from multiple text tokens
Sourcepub fn difficulty(&self) -> f64
pub fn difficulty(&self) -> f64
Get the difficulty
Sourcepub fn input_count(&self) -> u32
pub fn input_count(&self) -> u32
Get the number of inputs
pub fn to_string(&self) -> String
Trait Implementations§
Source§impl FromNapiMutRef for JsTrainingExample
impl FromNapiMutRef for JsTrainingExample
Source§unsafe fn from_napi_mut_ref(
env: napi_env,
napi_val: napi_value,
) -> Result<&'static mut Self>
unsafe fn from_napi_mut_ref( env: napi_env, napi_val: napi_value, ) -> Result<&'static mut Self>
Safety Read more
Source§impl FromNapiRef for JsTrainingExample
impl FromNapiRef for JsTrainingExample
Source§unsafe fn from_napi_ref(
env: napi_env,
napi_val: napi_value,
) -> Result<&'static Self>
unsafe fn from_napi_ref( env: napi_env, napi_val: napi_value, ) -> Result<&'static Self>
Safety Read more
Source§impl FromNapiValue for &JsTrainingExample
impl FromNapiValue for &JsTrainingExample
Source§unsafe fn from_napi_value(env: napi_env, napi_val: napi_value) -> Result<Self>
unsafe fn from_napi_value(env: napi_env, napi_val: napi_value) -> Result<Self>
Safety Read more
fn from_unknown(value: JsUnknown) -> Result<Self, Error>
Source§impl FromNapiValue for &mut JsTrainingExample
impl FromNapiValue for &mut JsTrainingExample
Source§unsafe fn from_napi_value(env: napi_env, napi_val: napi_value) -> Result<Self>
unsafe fn from_napi_value(env: napi_env, napi_val: napi_value) -> Result<Self>
Safety Read more
fn from_unknown(value: JsUnknown) -> Result<Self, Error>
Source§impl ObjectFinalize for JsTrainingExample
impl ObjectFinalize for JsTrainingExample
Source§impl ToNapiValue for JsTrainingExample
impl ToNapiValue for JsTrainingExample
Source§unsafe fn to_napi_value(
env: napi_env,
val: JsTrainingExample,
) -> Result<napi_value>
unsafe fn to_napi_value( env: napi_env, val: JsTrainingExample, ) -> Result<napi_value>
Safety Read more
Source§impl TypeName for &JsTrainingExample
impl TypeName for &JsTrainingExample
Source§impl TypeName for &mut JsTrainingExample
impl TypeName for &mut JsTrainingExample
Source§impl TypeName for JsTrainingExample
impl TypeName for JsTrainingExample
Source§impl ValidateNapiValue for &JsTrainingExample
impl ValidateNapiValue for &JsTrainingExample
Source§unsafe fn validate(env: napi_env, napi_val: napi_value) -> Result<napi_value>
unsafe fn validate(env: napi_env, napi_val: napi_value) -> Result<napi_value>
Safety Read more
Source§impl ValidateNapiValue for &mut JsTrainingExample
impl ValidateNapiValue for &mut JsTrainingExample
Source§unsafe fn validate(env: napi_env, napi_val: napi_value) -> Result<napi_value>
unsafe fn validate(env: napi_env, napi_val: napi_value) -> Result<napi_value>
Safety Read more
Auto Trait Implementations§
impl Freeze for JsTrainingExample
impl RefUnwindSafe for JsTrainingExample
impl Send for JsTrainingExample
impl Sync for JsTrainingExample
impl Unpin for JsTrainingExample
impl UnsafeUnpin for JsTrainingExample
impl UnwindSafe for JsTrainingExample
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more