/// <summary> /// Advanced OCR fixing via replace/spelling dictionaries + some hardcoded rules /// </summary> /// <param name="threeLetterIsoLanguageName">E.g. eng for English</param> /// <param name="hunspellName">Name of hunspell dictionary</param> /// <param name="parentForm">Used for centering/show spell check dialog</param> public OcrFixEngine(string threeLetterIsoLanguageName, string hunspellName, Form parentForm) { if (threeLetterIsoLanguageName == "per") { threeLetterIsoLanguageName = "fas"; } this.threeLetterIsoLanguageName = threeLetterIsoLanguageName; this.parentForm = parentForm; spellCheck = new OcrSpellCheck { StartPosition = FormStartPosition.Manual }; spellCheck.Location = new Point(parentForm.Left + (parentForm.Width / 2 - spellCheck.Width / 2), parentForm.Top + (parentForm.Height / 2 - spellCheck.Height / 2)); ocrFixReplaceList = OcrFixReplaceList.FromLanguageId(threeLetterIsoLanguageName); LoadSpellingDictionaries(threeLetterIsoLanguageName, hunspellName); // Hunspell etc. AutoGuessesUsed = new List<string>(); UnknownWordsFound = new List<string>(); }
public void Dispose() { if (hunspell != null) { hunspell.Dispose(); hunspell = null; } if (spellCheck == null) { return; } spellCheck.Dispose(); spellCheck = null; }