Simple Bayes v0.7.1 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", "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
    }
  }
}