Hacker News new | ask | show | jobs
by jacobevelyn 3826 days ago
Great question. Since the friends.md only stores friend names and activities, we have to be a bit creative in how we figure this out.

Currently, it looks at all of the past activities and in particular how often groups of friends appear together. For instance, if my activity is:

"Grabbed burgers and fries with Grace and George."

It will pick the "Grace" and "George" that appear most often together. In the case of a tie, or when there is only one name to match, it picks the ones who are closer friends (which for our purposes means they've been in more activities).

This works even for large groups, and it will brute-force every combination of all of the names with multiple friend matches to find the set with the highest score (based on pairs of friends, so a group of 10 friends will be matched correctly even if no activity has yet had exactly those 10 friends together). The brute force algorithm hasn't been slow enough to warrant any sort of constraint satisfaction optimization.

I've found this algorithm to work almost every time, because I find I usually refer to people (verbally and mentally) in groups ("Mark, Jane, and Stacy from work," "Jack and Jill's wedding," etc.), or use last names when I have more than one friend with a given first name and the one I'm referring to isn't the one I'm closest with (e.g. "Grace" would refer to my close friend Grace Hopper, while I might say "Grace Kelly" to refer to my acquaintance to clarify that it's not Grace Hopper).

I'm interested in ways to make this smarter still though, and/or better UX to allow the user to correct mistakes. Very interested in suggestions here if you have any!