@@ -10,19 +10,19 @@ import (
1010)
1111
1212const (
13- // ESAlphabet represents the alphabet of the Spanish vocabulary
13+ // ESAlphabet represents the alphabet of the Spanish vocabulary.
1414 ESAlphabet = "abcdefghijklmnopqrstuvwxyzñáéíóúü"
15- // ENAlphabet represents the alphabet of the English vocabulary
15+ // ENAlphabet represents the alphabet of the English vocabulary.
1616 ENAlphabet = "abcdefghijklmnopqrstuvwxyz"
1717)
1818
1919// Dictionary object is the main structure of the algorithm and it contains
20- // the alphabet in and the words that are built on top of that .
20+ // the alphabet in and the words.
2121type Dictionary struct {
22- // The alphabet which the dictionary is built
22+ // Alphabet of the dictionary.
2323 Alphabet string
24- // A map that contains the word and the number of apparitions on texts
25- // it will help to calculate the most probable correction
24+ // Words is a map that contains the word and the frequency number on texts,
25+ // it will help to calculate the most probable correction.
2626 Words map [string ]int
2727 filePath string
2828}
@@ -61,7 +61,7 @@ func LoadDictionary(filePath string) (*Dictionary, error) {
6161
6262// TrainFromTextFile reads all the words that can be found in the text file specified path,
6363// those will be used to train the dictionary.
64- // It returns any read or write errors encountered.
64+ // It returns any read/ write errors encountered.
6565func (d * Dictionary ) TrainFromTextFile (textFilePath string ) error {
6666 text , err := ioutil .ReadFile (textFilePath )
6767 if err != nil {
0 commit comments