How to deal with Input(text written by human) -> LOCODE



What algorithm (machine learning) do you use for solving this problem: input(text written by human) -> United Nations Code for Trade and Transport Locations (UN/LOCODE).
For example, Qingdao -> CNTAO.
However we may have incorrect spelling (Quingdao) or Aliases(Beigang, Dagang) => CNTAO.
ALL inputs must provide the same result.



One approach other than machine learning would be fuzzy string comparison. Python has a module for this called fuzzywuzzy . Typically what you can do is store the LOCODE in a list and compare the user input using fuzzywuzzy if the score is greater than a threshold, you can say it is the same country as in LOCODE table. Read more here

Hope this helps,
Sanad :slight_smile: