Function: relevanceToQuery()
ts
function relevanceToQuery(
text: string,
queryTokens: ReadonlySet<string>,
): number;Defined in: src/batteries/context/thrift/relevance.ts:135
What fraction of the QUERY's content words appear in text — the relevance of a prior turn to the CURRENT query (not the reverse: a turn need not share all its own content, only enough of the query's).
Parameters
| Parameter | Type | Description |
|---|---|---|
text | string | The candidate turn's combined text (see HistoryTurn.qa). |
queryTokens | ReadonlySet<string> | The current query's content-word set, from contentTokens. |
Returns
number
A fraction in [0, 1]; 0 when queryTokens is empty (an empty query matches nothing).