README.md

# Trivium
Library to generate 3 unique 3 word phrases, probably to use as slugs.

Also known as: "Ridiculously Handsome Teenager"

## Usage
Start the Dictionary genserver in your application.ex file
```elixir
def start(_, _) do
  Trivium.Dictionary,
  ...
end
```

Then, generate a new slug using:
`Trivium.generate()`

Or, use the Mix Task:
`mix slug.generate`

## Adding or replacing dictionaries
Trivium includes 3 word dictionaries; adverbs, adjectives, and nouns. All in English.

If you would like to use your own dictionaries, you can configure Trivium like this:
```elixir
# config.exs
:trivium,
  format: %{order: [:adjectives, :nouns]},
  sources: %{
    adjectives: Path.join(:code.priv_dir(:your_app), "src/your-adjectives.exs"),
    nouns: Path.join(:code.priv_dir(:your_app), "src/your-nouns.exs")
  }
```

## Caveats
This library makes no guarantee of uniqueness. Although the chances of a collison are exceedingly low, they are not zero.

You can calculate the entropy of your format and sources by calling: `Trivium.Dictionary.entropy()`

If you need to guarantee uniqueness, add an external validator (such as a Bloom filter or RDBMS unique column.)


## Installation

If [available in Hex](https://hex.pm/docs/publish), the package can be installed
by adding `trivium` to your list of dependencies in `mix.exs`:

```elixir
def deps do
  [
    {:trivium, "~> 0.1.0"}
  ]
end
```

Documentation can be generated with [ExDoc](https://github.com/elixir-lang/ex_doc)
and published on [HexDocs](https://hexdocs.pm). Once published, the docs can
be found at <https://hexdocs.pm/trivium>.