41+ results for 'spelling corrector lang:java' (4644 ms)
20@DisallowConcurrentExecution 21public class PopulateSpellingCorrectorJob implements Job { 22 25 26 public PopulateSpellingCorrectorJob() { 27 this.logger = Singleton.getLogger(); 32 Path path = Paths.get(Properties.getProperties().getProperty(Values.REPOSITORYLOCATION, Values.DEFAULTREPOSITORYLOCATION)); 33 this.logger.info(String.format("4f5b6cb6::starting populatespellingcorrector in path %s", path.toString())); 34 67 68 Singleton.getSearchCodeLib().addToSpellingCorrector(String.join(" ", codeLines)); 69 } catch (Exception ex) {SpellingCorrectorTest.java https://github.com/kbaribeau/Spelling-Corrector.git | Java | 57 lines
7public class SpellingCorrectorTest { 8 SpellingCorrector spellingCorrector = new SpellingCorrector(); 9 16 17 assertEquals(words, spellingCorrector.applySingleCharacterDeletions("the")); 18 } 26 27 assertEquals(words, spellingCorrector.applyTranspositions("test")); 28 } 31 public void shouldReturnAlterations() throws Exception { 32 assertEquals(101, spellingCorrector.applyOneLetterTypeos("test").size()); 33 } 42 public void shouldReturnTheCorrectWord() throws Exception { 43 assertEquals("access", spellingCorrector.correct("acess")); 44 assertEquals("access", spellingCorrector.correct("access"));Values.java https://github.com/boyter/searchcode-server.git | Java | 233 lines
44 public static final String DEFAULTINDEXTIME = "5"; 45 public static final String SPELLINGCORRECTORSIZE = "spelling_corrector_size"; 46 public static final String DEFAULTSPELLINGCORRECTORSIZE = "10000";SpellingCorrectorTest.java https://github.com/boyter/searchcode-server.git | Java | 123 lines
14 public void testEmptyNullTerms() { 15 ISpellingCorrector sc = this.getSpellingCorrector(); 16 assertNull(sc.correct(null)); 21 public void testSingleLetter() { 22 ISpellingCorrector sc = getSpellingCorrector(); 23 sc.correct("a"); 65 public void testSpellingCorrectorExtraLetter() { 66 ISpellingCorrector sc = this.getSpellingCorrector(); 67 sc.putWord("default"); 105 public void testLongStringPerformance() { 106 ISpellingCorrector sc = this.getSpellingCorrector(); 107 sc.correct("thisisareallylongstringthatshouldcalusethingstorunreallyslow"); 111 Random rand = new Random(); 112 ISpellingCorrector sc = getSpellingCorrector(); 113Main.java https://gitlab.com/mountain01/spelling-corrector.git | Java | 50 lines
4 5import spell.SpellCorrector.NoSimilarWordFoundException; 6 7/** 8 * A simple main class for running the spelling corrector 9 */ 21 /** 22 * Create an instance of your corrector here 23 */ 23 */ 24 SpellCorrector corrector = new SpellingCorrector(); 25 Trie trie1 = new Words(); 42 43 corrector.useDictionary(dictionaryFileName); 44SearchCodeLib.java https://github.com/boyter/searchcode-server.git | Java | 595 lines
26 27 private final ISpellingCorrector spellingCorrector; 28 private final FileClassifier fileClassifier; 39 public SearchCodeLib() { 40 this(Singleton.getSpellingCorrector(), new FileClassifier(), Singleton.getData(), Singleton.getHelpers()); 41 } 42 43 public SearchCodeLib(ISpellingCorrector spellingCorrector, FileClassifier fileClassifier, Data data, Helpers helpers) { 44 this.spellingCorrector = spellingCorrector; 168 /** 169 * Adds a string into the spelling corrector. 170 * TODO move this into the spelling corrector class itself 171 */ 172 public void addToSpellingCorrector(String contents) { 173 if (contents == null) {AdminRouteService.java https://github.com/boyter/searchcode-server.git | Java | 577 lines
125 map.put(Values.LOWMEMORY, Properties.getProperties().getProperty(Values.LOWMEMORY, Values.DEFAULTLOWMEMORY)); 126 map.put(Values.SPELLINGCORRECTORSIZE, Properties.getProperties().getProperty(Values.SPELLINGCORRECTORSIZE, Values.DEFAULTSPELLINGCORRECTORSIZE)); 127 map.put(Values.USESYSTEMGIT, Properties.getProperties().getProperty(Values.USESYSTEMGIT, Values.DEFAULTUSESYSTEMGIT)); 159 map.put("currentdatetime", this.getStat("servertime")); 160 map.put("spellingCount", this.getStat("spellingCount")); 161 map.put("runningJobs", this.getStat("runningJobs"));JobService.java https://github.com/boyter/searchcode-server.git | Java | 513 lines
15import com.searchcode.app.jobs.DeleteRepositoryJob; 16import com.searchcode.app.jobs.PopulateSpellingCorrectorJob; 17import com.searchcode.app.jobs.enqueue.EnqueueFileRepositoryJob; 97 this.startDeleteJob(); 98 this.startSpellingJob(); 99 this.startRepositoryJobs(); 299 /** 300 * Starts a background job which updates the spelling corrector 301 */ 301 */ 302 private void startSpellingJob() { 303 try { 303 try { 304 var job = newJob(PopulateSpellingCorrectorJob.class) 305 .withIdentity("spellingjob")20.java https://github.com/boyter/scc.git | Java | 186 lines
1package com.boyter.SpellingCorrector; 2 10 */ 11public class SpellingCorrector implements ISpellingCorrector { 12 15 16 public SpellingCorrector(int lruCount) { 17 this.dictionary = Collections.synchronizedMap(new LruCache<>(lruCount)); 121 /** 122 * Return a list of strings which are words similar to our one which could potentially be misspellings 123 * Abuse the fact that a char can be used as an integerSearchcodeSpellingCorrector.java https://github.com/boyter/searchcode-server.git | Java | 213 lines
24 */ 25public class SearchcodeSpellingCorrector implements ISpellingCorrector { 26 27 // How many terms to keep in the LRUCACHE 28 private int LRUCOUNT = Integer.parseInt(Values.DEFAULTSPELLINGCORRECTORSIZE); 29 35 public SearchcodeSpellingCorrector() { 36 this.LRUCOUNT = Integer.parseInt(Properties.getProperties().getProperty(Values.SPELLINGCORRECTORSIZE, Values.DEFAULTSPELLINGCORRECTORSIZE)); 37 if (this.LRUCOUNT <= 0) { 37 if (this.LRUCOUNT <= 0) { 38 this.LRUCOUNT = Integer.parseInt(Values.DEFAULTSPELLINGCORRECTORSIZE); 39 } 172 /** 173 * Return a list of strings which are words similar to our one which could potentially be misspellings 174 * Abuse the fact that a char can be used as an integerSingleton.java https://github.com/boyter/searchcode-server.git | Java | 413 lines
43 private static AbstractMap<String, RunningIndexJob> runningIndexRepoJobs = null; // Used to know which jobs are currently running 44 private static ISpellingCorrector spellingCorrectorInstance = null; 45 private static Queue<CodeIndexDocument> codeIndexQueue = null; // Documents ready to be indexed 188 189 public static synchronized ISpellingCorrector getSpellingCorrector() { 190 if (spellingCorrectorInstance == null) { 190 if (spellingCorrectorInstance == null) { 191 spellingCorrectorInstance = new SearchcodeSpellingCorrector(); 192 } 193 194 return spellingCorrectorInstance; 195 }SpellingCorrector.java https://github.com/kbaribeau/Spelling-Corrector.git | Java | 174 lines
14//python implementation 15public class SpellingCorrector { 16 private static final String alphabet = "abcdefghijklmnopqrstuvwxyz"; 18 19 public SpellingCorrector(){ 20 buildLanguageModel();Main.java https://gitlab.com/mountain01/cs240-labs.git | Java | 33 lines
4 5import spell.ISpellCorrector.NoSimilarWordFoundException; 6 7/** 8 * A simple main class for running the spelling corrector. This class is not 9 * used by the passoff program. 22 /** 23 * Create an instance of your corrector here 24 */ 24 */ 25 ISpellCorrector corrector = new Spell(); 26 26 27 corrector.useDictionary(dictionaryFileName); 28 String suggestion = corrector.suggestSimilarWord(inputWord);SpellingCorrector.java https://gitlab.com/mountain01/spelling-corrector.git | Java | 165 lines
13 14public class SpellingCorrector implements SpellCorrector { 15 17// public void test1() throws IOException, NoSimilarWordFoundException { 18// SpellingCorrector testSpell = new SpellingCorrector(); 19// testSpell.useDictionary("dictionary.txt");SpellingCorrectorTest.java https://github.com/juliengrenier/java-spelling-corrector.git | Java | 29 lines
1package spelling.corrector; 2 7import junit.framework.TestCase; 8import spelling.dictionary.Dictionary; 9 9 10public abstract class SpellingCorrectorTest extends TestCase { 11 14 Dictionary.load(Locale.ENGLISH, new File("holmes.txt")); 15 SpellingCorrector sp = getSpellingCorrector(); 16 String correction = sp.correct("speling"); 16 String correction = sp.correct("speling"); 17 assertEquals("spelling", correction); 18 correction = sp.correct(null); 26 27 abstract protected SpellingCorrector getSpellingCorrector(); 28StatSpellingCorrector.java https://github.com/juliengrenier/java-spelling-corrector.git | Java | 31 lines
1package spelling.corrector; 2 4 5public class StatSpellingCorrector implements SpellingCorrector { 6 final private SpellingCorrector corrector; 6 final private SpellingCorrector corrector; 7 protected StatSpellingCorrector(SpellingCorrector corrector){ 8 this.corrector = corrector; 10 protected StatSpellingCorrector(){ 11 this(new DefaultSpellingCorrector(new StatSpellingCorrectorHelper())); 12 } 13 public String correct(String word) { 14 System.out.println("StatSpellingCorrector.correct()"); 15 long begin = System.nanoTime(); 22 public Collection<String> getCandidates(String word) { 23 System.out.println("StatSpellingCorrector.getCandidates()"); 24 long begin = System.nanoTime();SpellingCorrectorHelperTest.java https://github.com/juliengrenier/java-spelling-corrector.git | Java | 71 lines
1package spelling.corrector; 2 7 8public abstract class SpellingCorrectorHelperTest extends 9 TestCase { 69 70 abstract protected SpellingCorrectorHelper getHelper(); 71}SpellingCorrectorHelper.java https://github.com/juliengrenier/java-spelling-corrector.git | Java | 57 lines
1package spelling.corrector; 2 5 6public interface SpellingCorrectorHelper { 7DefaultSpellingCorrector.java https://github.com/juliengrenier/java-spelling-corrector.git | Java | 62 lines
1package spelling.corrector; 2 8 9import spelling.dictionary.Dictionary; 10 10 11public class DefaultSpellingCorrector implements SpellingCorrector { 12 private final Dictionary dictionnary; 13 private final SpellingCorrectorHelper helper; 14 protected DefaultSpellingCorrector(SpellingCorrectorHelper helper){ 15 this(helper,Locale.ENGLISH); 16 } 17 protected DefaultSpellingCorrector(SpellingCorrectorHelper helper,Locale locale){ 18 this.helper = helper;CorrectorLauncher.java https://github.com/juliengrenier/java-spelling-corrector.git | Java | 70 lines
9import spelling.corrector.CorrectorBuilder; 10import spelling.corrector.SpellingCorrector; 11import spelling.dictionary.Dictionary; 16 try { 17 SpellingCorrector sc = handleCommandLine(args); 18 Scanner inputScanner = new Scanner(System.in); 30 } 31 private static SpellingCorrector handleCommandLine(String[] args) throws IOException { 32 boolean hasCommandFlag = args.length > 0; 61 62 SpellingCorrector corrector = CorrectorBuilder.buildCorrector(isVerbose); 63 return corrector; 66 private static void showHelp() { 67 System.out.println("Usage SpellingCorrector [-h -f filename -v] \n\t-h : Show this help\n\t-f filename : Use this file to train the corrector\n\t-v [all] : Print statistic for methods if \"all\" then print statistic for every methods"); 68 System.exit(0);KGramWithEditDistanceSpellingCorrector.java https://github.com/rioleo/huangenius.git | Java | 43 lines
11 12public class KGramWithEditDistanceSpellingCorrector implements SpellingCorrector { 13 /** Initializes spelling corrector by indexing kgrams in words from a file */ 14 15 KGramSpellingCorrector KGram; 16 16 17 public KGramWithEditDistanceSpellingCorrector() { 18 KGram = new KGramSpellingCorrector();KGramSpellingCorrector.java https://github.com/rioleo/huangenius.git | Java | 101 lines
11 12public class KGramSpellingCorrector implements SpellingCorrector { 13 /** Initializes spelling corrector by indexing kgrams in words from a file */ 16 17 public KGramSpellingCorrector() { 18StatSpellingCorrectorHelper.java https://github.com/juliengrenier/java-spelling-corrector.git | Java | 75 lines
1package spelling.corrector; 2 5 6public class StatSpellingCorrectorHelper implements SpellingCorrectorHelper { 7 final private SpellingCorrectorHelper helper; 8 9 protected StatSpellingCorrectorHelper(SpellingCorrectorHelper helper) { 10 this.helper = helper; 12 13 protected StatSpellingCorrectorHelper() { 14 this(new DefaultSpellingCorrectorHelper()); 17 public List<String> getAlterations(String word) { 18 System.out.println("StatSpellingCorrectorHelper.getAlterations()"); 19 long begin = System.nanoTime(); 26 public List<String> getDeletion(String word) { 27 System.out.println("StatSpellingCorrectorHelper.getDeletion()"); 28 long begin = System.nanoTime();DefaultSpellingCorrectorHelper.java https://github.com/juliengrenier/java-spelling-corrector.git | Java | 68 lines
1package spelling.corrector; 2 9 10public class DefaultSpellingCorrectorHelper implements SpellingCorrectorHelper { 11KGramWithEditAndFreqSpellingCorrector.java https://github.com/rioleo/huangenius.git | Java | 47 lines
11 12public class KGramWithEditAndFreqSpellingCorrector implements SpellingCorrector { 13 /** Initializes spelling corrector by indexing kgrams in words from a file */ 14 15 KGramWithEditDistanceSpellingCorrector KGram; 16 KGramSpellingCorrector simpleKGram; 17 18 public KGramWithEditAndFreqSpellingCorrector() { 19 KGram = new KGramWithEditDistanceSpellingCorrector(); 19 KGram = new KGramWithEditDistanceSpellingCorrector(); 20 simpleKGram = new KGramSpellingCorrector(); 21 }SpellingCorrector.java https://bitbucket.org/skyline0623/spellingcorrector.git | Java | 93 lines
7 8public class SpellingCorrector { 9 private HashMap<String, Integer> nWords = new HashMap<String, Integer>(); 9 private HashMap<String, Integer> nWords = new HashMap<String, Integer>(); 10 public SpellingCorrector(String path) throws IOException{ 11 BufferedReader reader = new BufferedReader(new FileReader(new File(path))); 79 public static void main(String[] args)throws IOException { 80 SpellingCorrector sc = new SpellingCorrector("big.txt"); 81 while(true){KGramWithSoundexSpellingCorrector.java https://github.com/rioleo/huangenius.git | Java | 66 lines
11 12public class KGramWithSoundexSpellingCorrector implements SpellingCorrector { 13 /** Initializes spelling corrector by indexing kgrams in words from a file */ 14 15 KGramWithEditDistanceSpellingCorrector KGram; 16 KGramSpellingCorrector simpleKGram; 17 18 public KGramWithSoundexSpellingCorrector() { 19 KGram = new KGramWithEditDistanceSpellingCorrector(); 19 KGram = new KGramWithEditDistanceSpellingCorrector(); 20 simpleKGram = new KGramSpellingCorrector(); 21 }IMDBReader.java https://github.com/rioleo/huangenius.git | Java | 162 lines
20import cs276.util.Counter; 21import cs276.pe1.spell.KGramWithEditDistanceSpellingCorrector; 22import cs276.util.StringUtils; 25 26 static KGramWithEditDistanceSpellingCorrector spellChecker = new KGramWithEditDistanceSpellingCorrector(); 27SpellingCorrector.java https://github.com/sarnoff/CS276.git | Java | 24 lines
5/** 6 * Basic interface for the spelling corrector. 7 * 9 */ 10public interface SpellingCorrector { 11 12 /** 13 * Returns list of possible spelling corrections for a given 14 * (possibly misspelled) word. The length of the returned list 15 * is up to the implementer, but enough high-scoring candidates 16 * should be included so that the best corrected spelling is 17 * present (high) in the list. 18 * 19 * @param word A single word whose spelling is to be checked. 20 * @return A list of possible corrections, with better correctionsIMDBSpelling.java https://github.com/sarnoff/CS276.git | Java | 57 lines
22 23import cs276.pe1.spell.KGramSpellingCorrector; 24import cs276.pe1.spell.KGramWithEditDistanceSpellingCorrector; 26@SuppressWarnings("deprecation") 27public class IMDBSpelling { 28 public static void main(String[] args) throws Exception { 34 //Spelling correct query 35 KGramWithEditDistanceSpellingCorrector k = new KGramWithEditDistanceSpellingCorrector(); 36 List<String> suggest = k.corrections(search);SpellingScorer.java https://github.com/rioleo/huangenius.git | Java | 96 lines
11/** 12 * Scorer for evaluating a SpellingCorrector. Reads a file 13 * that contains correctly spelled words and, for each, one or 13 * that contains correctly spelled words and, for each, one or 14 * more mis-spellings. A SpellingCorrector class is then 15 * instantiated (the specific type is passed as an argument 29 System.err.println("Usage: "); 30 System.err.println(" (java-cmd) SpellingScorer cs276.pe1.spell.YourSpellingCorrectorClass"); 31 System.err.println(); 51 // instantiate scorer 52 SpellingCorrector scorer = null; 53 try { 54 Class<?> type = Class.forName(argv[0]); 55 scorer = (SpellingCorrector)type.newInstance(); 56 } catch (Exception e) {TestAllDictionaries2.java https://github.com/mdodsworth/lucene-solr.git | Java | 221 lines
57 "bengali_bangladesh_dictionary-0.08-sm+tb+fx.xpi", "dictionaries/bn-BD.dic", "dictionaries/bn-BD.aff", 58 "brazilian_portuguese_dictionary_former_spelling-28.20140203-tb+sm+fx.xpi", "dictionaries/pt-BR-antigo.dic", "dictionaries/pt-BR-antigo.aff", 59 "brazilian_portuguese_dictionary_new_spelling-28.20140203-fx+sm+tb.xpi", "dictionaries/pt-BR.dic", "dictionaries/pt-BR.aff", 64 "chichewa_spell_checker-0.3-fx+tb+fn+sm+sb.xpi", "dictionaries/ny_MW.dic", "dictionaries/ny_MW.aff", 65 "corrector_de_galego-13.10.0-fn+sm+tb+fx.xpi", "dictionaries/gl_ES.dic", "dictionaries/gl_ES.aff", 66//BUG: broken flags "corrector_orthographic_de_interlingua-6.0-fn+sm+tb+fx.xpi", "dictionaries/ia-ia.dic", "dictionaries/ia-ia.aff", 66//BUG: broken flags "corrector_orthographic_de_interlingua-6.0-fn+sm+tb+fx.xpi", "dictionaries/ia-ia.dic", "dictionaries/ia-ia.aff", 67 "corrector_ortografico_aragones-0.2-fx+tb+sm.xpi", "dictionaries/an_ES.dic", "dictionaries/an_ES.aff", 68 "croatian_dictionary_-_hrvatski_rjecnik-1.0.1-firefox+thunderbird+seamonkey.xpi", "dictionaries/hr.dic", "dictionaries/hr.aff", 99 "german_dictionary_switzerland-2.0.3-sm+fx+tb+fn.xpi", "dictionaries/de-CH.dic", "dictionaries/de-CH.aff", 100 "greek_spelling_dictionary-0.8.5-fx+tb+sm.xpi", "dictionaries/el-GR.dic", "dictionaries/el-GR.aff", 101 "gujarati_spell_checker-0.3-fx+tb+fn+sm+sb.xpi", "dictionaries/gu_IN.dic", "dictionaries/gu_IN.aff", 102 "haitian_creole_spell_checker-0.08-tb+sm+fx.xpi", "dictionaries/ht-HT.dic", "dictionaries/ht-HT.aff", 103 "hausa_spelling_dictionary-0.2-tb+fx.xpi", "dictionaries/ha-GH.dic", "dictionaries/ha-GH.aff", 104 "hebrew_spell_checking_dictionary_from_hspell-1.2.0.1-fx+sm+tb.xpi", "dictionaries/he.dic", "dictionaries/he.aff",KGramSpellingCorrector.java https://github.com/sarnoff/CS276.git | Java | 104 lines
14 15public class KGramSpellingCorrector implements SpellingCorrector { 16 protected static int K = 2; //start with bigrams, then extend out 18 protected static int WL = 10;//returned Word List size 19 /** Initializes spelling corrector by indexing kgrams in words from a file */ 20 protected Map<String,Set<String>> kgram; 21 protected Counter<String> freq; 22 public KGramSpellingCorrector() { 23 File path = new File("/afs/ir/class/cs276/pe1-2011/big.txt.gz");KGramWithEditDistanceSpellingCorrector.java https://github.com/sarnoff/CS276.git | Java | 77 lines
9 10public class KGramWithEditDistanceSpellingCorrector extends KGramSpellingCorrector { 11 public enum ListCompare { 18 protected static ListCompare correctionsType = ListCompare.NORMALIZE; 19 public KGramWithEditDistanceSpellingCorrector() { 20 super();DefaultSpellingCorrectorTest.java https://github.com/juliengrenier/java-spelling-corrector.git | Java | 10 lines
1package spelling.corrector; 2 2 3public class DefaultSpellingCorrectorTest extends SpellingCorrectorTest{ 4 5 @Override 6 protected SpellingCorrector getSpellingCorrector() { 7 return new DefaultSpellingCorrector(new DefaultSpellingCorrectorHelper());StatSpellingCorrectorHelperTest.java https://github.com/juliengrenier/java-spelling-corrector.git | Java | 10 lines
1package spelling.corrector; 2 3 4public class StatSpellingCorrectorHelperTest extends SpellingCorrectorHelperTest{ 5 6 @Override 7 protected SpellingCorrectorHelper getHelper() { 8 return new StatSpellingCorrectorHelper();StatSpellingCorrectorTest.java https://github.com/juliengrenier/java-spelling-corrector.git | Java | 11 lines
1package spelling.corrector; 2 3 4public class StatSpellingCorrectorTest extends SpellingCorrectorTest { 5 6 @Override 7 protected SpellingCorrector getSpellingCorrector() { 8 return new StatSpellingCorrector();DefaultSpellingCorrectorHelperTest.java https://github.com/juliengrenier/java-spelling-corrector.git | Java | 11 lines
1package spelling.corrector; 2 3 4public class DefaultSpellingCorrectorHelperTest extends SpellingCorrectorHelperTest { 5 6 @Override 7 protected SpellingCorrectorHelper getHelper() { 8 return new DefaultSpellingCorrectorHelper();SpellingCorrector.java https://github.com/juliengrenier/java-spelling-corrector.git | Java | 21 lines
1package spelling.corrector; 2 4 5public interface SpellingCorrector { 6ISpellingCorrector.java https://github.com/boyter/searchcode-server.git | Java | 28 lines
15 16public interface ISpellingCorrector { 17 int getWordCount();CorrectorBuilder.java https://github.com/juliengrenier/java-spelling-corrector.git | Java | 23 lines
1package spelling.corrector; 2 3 4public class CorrectorBuilder { 5 private static SpellingCorrectorHelper buildHelper(boolean isVerbose){ 5 private static SpellingCorrectorHelper buildHelper(boolean isVerbose){ 6 SpellingCorrectorHelper helper = new DefaultSpellingCorrectorHelper(); 7 if(isVerbose){ 7 if(isVerbose){ 8 return new StatSpellingCorrectorHelper(helper); 9 }else{ 14 public static SpellingCorrector buildCorrector(boolean isVerbose){ 15 SpellingCorrector corrector = new DefaultSpellingCorrector(buildHelper(isVerbose)); 16 if(isVerbose){ 16 if(isVerbose){ 17 return new StatSpellingCorrector(corrector); 18 }else{