Simple Bayes v1.0.0 SimpleBayes.Trainer.TokenRecorder

Link to this section Summary

Functions

Records the tokens from each training

Link to this section Functions

Link to this function record(arg, category, opts)

Records the tokens from each training.

Examples

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

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