Skip to content

woctezuma/heroku-levenshtein-api

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

21 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Heroku Levenshtein API

Deploy an API built with Flask on Heroku, in order to match game names with Levenshtein distance.

Data

Data consists of app ids and names from the Steam store (~30k games) downloaded on January 9, 2021.

Usage

To create the database of game names in lower case:

python app/file_utils.py

To run locally:

python run.py

To deploy:

heroku login
heroku create
git push heroku main

Web App

The web app can be accessed at this URL:

https://arcane-springs-42307.herokuapp.com/

To ask for results about "Cyberpunk 2077", and constrain the response to 10 matches:

https://arcane-springs-42307.herokuapp.com/find/?name="Cyberpunk 2077"&n=10

CORS and rate-limits

If you want to make your web app accessible from a Single-Page Application, e.g. written in Svelte, then you will want to specify CORS and rate-limits.

See the cors branch of my repository for more information.

Results

The Levenshtein distance is not intuitive for the user.

For instance, when looking for "The Witcher 3", which has a longer title on the Steam store, the Levenshtein distance does not return the correct result, because it looks for minimal edit sequences.

Wrong match Correct match

I would recommend to try another method such as difflib, which looks for the "longest contiguous matching subsequence".

References