# `Imp.Retrieve.Memory`
[🔗](https://github.com/deepfates/imp/blob/v0.18.1/lib/imp/retrieve.ex#L124)

Token-overlap in-memory retriever for deterministic local workflows.

`Memory` is useful for examples, tests, Livebooks, and portable save/load
workflows. It scores documents by token overlap with the query and returns
up to `k` of the documents that share at least one token with it, best
first, each with an added `:score` field. A document that shares none is
not a match and is not returned.

# `new`

Builds an in-memory retriever from document maps or keyword-list documents.

    iex> retriever = Imp.Retrieve.Memory.new([[text: "Elixir runs on the BEAM"]], k: 1)
    iex> {:ok, docs} = Imp.Retrieve.retrieve(retriever, "BEAM")
    iex> docs
    [%{text: "Elixir runs on the BEAM", score: 1}]

---

*Consult [api-reference.md](api-reference.md) for complete listing*
