# `Kreuzberg.Keyword`
[🔗](https://github.com/kreuzberg-dev/kreuzberg/blob/main/lib/kreuzberg/keyword.ex#L1)

Structure representing an extracted keyword with score and algorithm info.

## Fields

  * `:text` - The keyword text
  * `:score` - Relevance score (algorithm-dependent)
  * `:algorithm` - Algorithm used for extraction (e.g., "yake", "rake")
  * `:positions` - Optional list of positions where keyword appears

# `t`

```elixir
@type t() :: %Kreuzberg.Keyword{
  algorithm: String.t(),
  positions: [non_neg_integer()] | nil,
  score: float(),
  text: String.t()
}
```

# `from_map`

```elixir
@spec from_map(map()) :: t()
```

Create a Keyword struct from a map.

## Examples

    iex> Kreuzberg.Keyword.from_map(%{
    ...>   "text" => "elixir",
    ...>   "score" => 0.95,
    ...>   "algorithm" => "yake"
    ...> })
    %Kreuzberg.Keyword{
      text: "elixir",
      score: 0.95,
      algorithm: "yake",
      positions: nil
    }

# `to_map`

```elixir
@spec to_map(t()) :: map()
```

Convert a Keyword struct to a map.

## Examples

    iex> kw = %Kreuzberg.Keyword{text: "elixir", score: 0.95, algorithm: "yake"}
    iex> Kreuzberg.Keyword.to_map(kw)
    %{
      "text" => "elixir",
      "score" => 0.95,
      "algorithm" => "yake",
      "positions" => nil
    }

---

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