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
Summary
Types
@type t() :: %Kreuzberg.Keyword{ algorithm: String.t(), positions: [non_neg_integer()] | nil, score: float(), text: String.t() }
Functions
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
}
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
}