aabishkaryal / aabishkaryal/nepal-districts

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

オープン
#18 コメント 7 件 リアクション 1 件 担当者 0 名 GitHub で見る
discussion
主要言語
TypeScript
スター
35
フォーク
17
PR マージ指標
30日以内にマージされた PR はありません

説明

**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.

コントリビューションガイド

このリポジトリのコントリビューションガイドは索引されていません

評価

この issue はまだ評価されていません。

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。