rarity_max

The functionrarity_max(str fieldname)returns the rarity score of matched keywords. The functions can calculate this score over keywords or lists of keywords, using the TF-IDF formula.

Input

  • fieldname1 (str) - the name of the field to match in query document. params[fieldname1] must be of type keyword or list[keyword]

  • fieldname2 (str, default=fieldname1) - the name of the field to match in database document. V[fieldname2] must be of type keyword or list[keyword]

Output

  • score (float) - TF-IDF for the matched keywords. If params[fieldname] and params[fieldname] are lists of, the function will return the max of rarity score out of all matched keywords

Example:

score = rarity_max("cities")

The function will return the maximum rarity score of all matched keywords between params["cities"] and doc["cities"]

Last updated