aabishkaryal / aabishkaryal/nepal-districts
[ Discussion ]: prevent user from typing mis-matched name of districts
- 主要語言
- 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 還沒有評估資料。