MCPcopy Index your code
hub / github.com/tinyplex/tinybase / getWeighting

Function getWeighting

site/js/common/search.ts:246–250  ·  view source on GitHub ↗
(tokens: string, word: string)

Source from the content-addressed store, hash-verified

244
245// Get the weighting of a word in a string based on its position
246const getWeighting = (tokens: string, word: string) => {
247 const length = tokens.length;
248 const position = tokens.indexOf(word);
249 return position === -1 ? 0 : (length - position) / length;
250};

Callers 2

searchLoadFunction · 0.85
populateResultsFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…