compute_rarity() assigns a rarity score to each token produced by
prepare_search_data(), using the rarity method defined in a
Search_Strategy.
Arguments
- tokens
A token table created by
prepare_search_data(), in any backend-specific representation. Must contain at leastcolumn,token, androw_id, plus anyblock_bycolumns.- strategy
A
Search_Strategydefining the rarity method, blocking variables, and field structure.- ...
Additional arguments passed to backend-specific methods.
Details
Rarity quantifies how informative a token is when comparing records. In joinery, rarity is always computed:
using one global rarity metric specified in the strategy,
per column, because each field has its own token distribution,
within each block (if the strategy specifies
block_by).
The input tokens must be the long-format token table returned by
prepare_search_data(), containing at minimum:
an ID column,
a
columnfield indicating the source variable,a
tokenfield,a
row_ididentifying the originating record,and any
block_byvariables required by the strategy.
Backends (e.g., data.frame, data.table, DuckDB relations) may implement
their own methods for this generic, but all must return the same logical
structure: the original token table with an added numeric rarity column.
