private void timerGoogle_Tick(object sender, EventArgs e) { timerGoogle.Enabled = false; Correction correction = new Correction(); // find Suggestion using Google: int Key = errors.ElementAtOrDefault(indexTimerGoogle).Key; if (Key == 0) { ResetControls(true); return; } string logGoogle; int totalHits; string googleSuggestion = correction.GetGoogleSuggestionFromTrigram(deHyphenateTokens, Key, out totalHits, out logGoogle); // jika suggestion sama dengan err & totalhits kosong (artinya pencarian tidak ada hasil) coba search bigram: if (googleSuggestion == deHyphenateTokens[Key] && totalHits == 0) { string logGoogleBigram; googleSuggestion = correction.GetGoogleSuggestionFromBigram(deHyphenateTokens, Key, out totalHits, out logGoogleBigram); logGoogle += logGoogleBigram; } // jika suggestion berbeda dg err maka Change suggestion back to Old Spell: if (googleSuggestion != deHyphenateTokens[Key]) { googleSuggestion = correction.ChangeNewToOldSpell(googleSuggestion); // update token dic with suggestion: deHyphenateTokens[Key] = "[" + googleSuggestion + "]"; } else { googleSuggestion = deHyphenateTokens[Key]; logGoogle = deHyphenateTokens[Key] + " is correct"; } // for analysis: if (!string.IsNullOrEmpty(articleFileGT)) { correction.UpdateFields(articleFileName, Key, new Dictionary <string, string> { { getFieldNameFromOption(), googleSuggestion }, { getFieldNameFromOption().Replace("Correction", "Log"), logGoogle } }); } indexTimerGoogle++; Random r = new Random(); int interval = r.Next(7000, 13000); timerGoogle.Interval = interval; timerGoogle.Enabled = true; }