educative.io

Educative

Question on update the frequencies of typeahead suggestions?

Could you please elaborate more on this part “How can we update the frequencies of typeahead suggestions? Since we are storing frequencies of our typeahead suggestions with each node, we need to update them too! We can update only differences in frequencies rather than recounting all search terms from scratch. If we’re keeping count of all the terms searched in last 10 days, we’ll need to subtract the counts from the time period no longer included and add the counts for the new time period being included”

I don’t understand the subtraction you are mentioning here???

Maybe this approach is giving more preference to the latest searched terms. In such cases a term which a user has not used for a specific amt of time (here it’s 10 days), is less likely to be used again. So, the need to substract the frequency count of this word search before this time period (here 11th day).

For eg. a month ago you were calling someone “bro”, but recently you started using “bruh”, you are more likely to use “bruh” more than “bro” now. But, if “bro” had like a 1000 count (you knew this guy from long back say), and “bruh” only has like a 50 count, the suggestion system would suggest “bro” instead of “bruh”.

This will not happen if you substract the count of “bro” with every passing time slot of say 10 days. Think of it like an unused word loosing popularity.

At-least this is what I could come up with. correct me if I am making any wrong assumption.