aabishkaryal / aabishkaryal/nepal-districts

[ Discussion ]: prevent user from typing mis-matched name of districts

Open
#18 7 comments 1 reaction 0 assignees View on GitHub
discussion
Dominant language
TypeScript
Stars
35
Forks
17
PR merge metrics
No merged PRs in 30d

Description

**This problem cannot be fixed by allowing user to create PR for possible "Typo" of district name.**

**Example:**
- Tehrathum -> comes from [Wiki](https://en.wikipedia.org/wiki/Tehrathum_District)
- Terhathum -> Might come from locals of that district and depends on how they spell it using Roman Nepali

For now, all the PR that fixes the typo should be checked against if it matches the name on Wiki page & we have different name on our data source.

### The future enhancement:

I was thinking of something like creating a validation notice on input field that validates the input data to "look a like" with one of the data we have on our source.

**Example of this feature:**
- Tehrathum -> The one we have on the data source
- Terhathum -> The one user might type / expect

The input validation should check if `Terhathum` ( the user input ) has similar word on our data source.

If the matching ratio is higher, suggest the word in error message with the word we have on data source:
> "Did you mean "Tehrathum" ?

### Reference
Check [Levenshtein Distance Algorithm](https://en.wikipedia.org/wiki/Levenshtein_distance) for the implementation.

This issue is open for discussion, please add your comments & suggestions.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.