Matching and scores
Two endpoints match free text against institution names:
GET /v1/schools/autocompletetakes a fragment that someone is still typing. See Building a school picker.POST /v1/schools/resolvetakes complete names, usually from a spreadsheet. See Resolving names in batch.
Both match against every name an institution is published under: the official name, acronyms, trade names, former names, and others.
Each endpoint scores differently
Section titled “Each endpoint scores differently”A score is a trigram similarity, a measure of how many three-character sequences two strings share. Resolve compares your whole name with the whole institution name. That penalizes a short fragment for everything it leaves out, which suits a complete name and fails a fragment.
So autocomplete compares your fragment with the best-matching stretch of the name instead:
| Query | Resolve’s score against HARVARD UNIVERSITY |
Autocomplete’s score |
|---|---|---|
HAR |
0.150 | 0.750 |
HARV |
0.200 | 0.800 |
HARVARD |
0.421 | 1.000 |
HARVARD UNIVERSITY |
1.000 | 1.000 |
Autocomplete drops candidates below 0.6 and resolve drops them below 0.3. Never compare a score from one endpoint with a score from the other.
score is not confidence
Section titled “score is not confidence”Nothing calibrates score against whether a match is correct. Resolving Wright College within Illinois ranks Fox College first at 0.421, and City Colleges of Chicago-Wilbur Wright College, probably the school meant, fourth at 0.405. A short name made mostly of a common word scores close to every name that contains the word.
- Use
scoreto order candidates. - Use
city,state, andmatchedNameto decide which candidate is right. - Don’t treat a score threshold as a probability.
Narrowing by state removes most wrong candidates. As the example shows, it doesn’t make the top one right.
What matched
Section titled “What matched”matchedName is the name that scored, which is often not the official name. Show it, so the person reading a result can see which name agreed with theirs. matchedType says what kind of name it was, such as official, acronym, former, or dba, a trade name. alias means the source published an alternate name without saying what kind. Endpoints lists every value.
Autocomplete withholds some matches
Section titled “Autocomplete withholds some matches”On autocomplete, when the name that matched is not the official name, matchedName and score are both null. matchedType still has a value, so you can show that a result matched an acronym or a former name. Resolve never withholds them.
The two are withheld together because an exact score on a hidden name lets someone recover the name one character at a time. Both keys are always present, sometimes null, so don’t branch on whether the key exists.
One institution, one result
Section titled “One institution, one result”An institution appears once in a result list, however many of its names match. It is represented by its best-scoring name.
Results are not ranked by prominence
Section titled “Results are not ranked by prominence”A query for a common word returns institutions that match it, not the ones you have heard of. UNIVERSITY matches thousands of names, and every one scores 1.0. Add a state or more of the name to narrow it.