aabishkaryal / aabishkaryal/nepal-districts

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

Aperta
#18 7 commenti 1 reazione 0 assegnatari Vedi su GitHub
discussion
Lingua principale
TypeScript
Stelle
35
Fork
17
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Descrizione

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

Guida per i contributori

Nessuna guida per i contributori indicizzata per questo repository

Direzione di ricerca

Esamina il componente del campo di input in cui vengono inseriti i nomi dei distretti. La fonte dei dati è probabilmente un file JSON o un'API con i nomi dei distretti. Implementa la distanza di Levenshtein per confrontare l'input dell'utente con l'elenco di origine e mostra un suggerimento quando la similarità è elevata. Esegui il test digitando varianti come 'Terhathum' per verificare se viene suggerito 'Tehrathum'.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Ambito
frontend
Tipo di issue
Funzionalità
Difficoltà
3/5
Tempo stimato
1-2 giorni
Stato di attività
Ferma
Chiarezza
Abbastanza chiara
Idoneità per principianti
50/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.