Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/woctezuma/heroku-levenshtein-api

Deploy an API built with Flask on Heroku, in order to match game names.
https://github.com/woctezuma/heroku-levenshtein-api

api flask heroku levenshtein

Last synced: about 1 month ago
JSON representation

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

Awesome Lists containing this project

README

        

# 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][data-snapshot].

## Usage

To create the database of game names in lower case:

```bash
python app/file_utils.py
```

To run locally:

```bash
python run.py
```

To deploy:

```bash
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][api-example]

## 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][wiki-witcher-match-wrong] ![Correct match][wiki-witcher-match]

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

## References

- [`heroku-flask-api`][flask-clip-api]
- [`heroku-levenshtein-api`][flask-levenshtein-api]

[data-snapshot]:

[flask-clip-api]:

[flask-levenshtein-api]:

[api-example]:

[wiki-witcher-match-wrong]:
[wiki-witcher-match]:

[difflib-doc]: