Simple Bayes v0.4.2 SimpleBayes.Trainer.TokenRecorder

Summary

Functions

Records the tokens from each training

Functions

record(arg, category, opts)

Records the tokens from each training.

Examples

iex> SimpleBayes.Trainer.TokenRecorder.record(
iex>   {
iex>     %{"cute" => 1, "dog" => 1},
iex>     %SimpleBayes{}
iex>   },
iex>   :dog,
iex>   %{}
iex> )
{
  %{"cute" => 1, "dog" => 1},
  %SimpleBayes{
    tokens_per_training: [dog: %{{"cute", 1} => 1, {"dog", 1} => 1}]
  }
}

iex> SimpleBayes.Trainer.TokenRecorder.record(
iex>   {
iex>     %{"cute" => 1, "good" => 1},
iex>     %SimpleBayes{
iex>       tokens_per_training: [dog: %{{"cute", 1} => 1, {"dog", 1} => 1}]
iex>     }
iex>   },
iex>   :dog,
iex>   %{}
iex> )
{
  %{"cute" => 1, "good" => 1},
  %SimpleBayes{
    tokens_per_training: [
      dog: %{{"cute", 1} => 1, {"dog", 1} => 1},
      dog: %{{"cute", 1} => 1, {"good", 1} => 1}
    ]
  }
}