You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
//for benchmarking only: with CreateDictionary("big.txt","") and the text corpus from http://norvig.com/big.txt the Regex below provides the exact same number of dictionary items as Norvigs regex "[a-z]+" (which splits words at apostrophes & incompatible with non-latin characters)
//Fix: previously not allways all suggestions were returned for verbose<2 : e.g. elove did not return love (edit distance=0)
348
+
//Fix: previously not allways all suggestons within editdistance (verbose=1) or the best suggestion (verbose=0) were returned : e.g. elove did not return love
355
349
//suggestions.Clear() was not executed in this branch, if a suggestion with lower edit distance was added here (for verbose<2).
356
350
//Then possibly suggestions with higher edit distance remained on top, the suggestion with lower edit distance were added to the end.
357
351
//All of them where deleted later once a suggestion with a lower distance than the first item in the list was later added in the other branch.
//Load a frequency dictionary or create a frequency dictionary from a text corpus
608
599
publicstaticvoidMain(string[]args)
609
600
{
610
-
//Create the dictionary from a sample corpus
611
-
//e.g. http://norvig.com/big.txt , or any other large text corpus
601
+
//Manually curating/cleaning up the dictionary or using a professional frequency dictionary will increase the precision of the spelling correction.
602
+
//Load a frequency dictionary
603
+
LoadDictionary("wordfrequency_en.txt","",0,1);
604
+
605
+
//Create the dictionary from a text corpus (e.g. http://norvig.com/big.txt )
606
+
//Make sure the corpus does not contain spelling errors, invalid terms and the word frequency is representative to increase the precision of the spelling correction.
607
+
//
612
608
//The dictionary may contain vocabulary from different languages.
613
609
//If you use mixed vocabulary use the language parameter in Correct() and CreateDictionary() accordingly.
610
+
//
614
611
//You may use CreateDictionaryEntry() to update a (self learning) dictionary incrementally
612
+
//
615
613
//To extend spelling correction beyond single words to phrases (e.g. correcting "unitedkingom" to "united kingdom") simply add those phrases with CreateDictionaryEntry().
616
614
//CreateDictionary("big.txt","");
617
615
618
-
//Manually curating/cleaning up the dictionary or using a professional frequency dictionary will increase the precision of the suggestions.
0 commit comments