コード例 #1
0
        /// <summary>
        /// Advanced ocr fixing via replace/spelling dictionaries + some hardcoded rules
        /// </summary>
        /// <param name="threeLetterIsoLanguageName">E.g. eng for English</param>
        /// <param name="parentForm">Used for centering/show spellcheck dialog</param>
        public OcrFixEngine(string threeLetterIsoLanguageName, string hunspellName, Form parentForm)
        {
            _threeLetterIsoLanguageName = threeLetterIsoLanguageName;
            _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));

            LoadReplaceLists(threeLetterIsoLanguageName);
            LoadSpellingDictionaries(threeLetterIsoLanguageName, hunspellName); // Hunspell etc.

            AutoGuessesUsed = new List<string>();
            UnknownWordsFound = new List<string>();
        }
コード例 #2
0
 public void Dispose()
 {
     if (_hunspell != null)
     {
         _hunspell.Dispose();
         _hunspell = null;
     }
     if (_spellCheck != null)
     {
         _spellCheck.Dispose();
         _spellCheck = null;
     }
 }
コード例 #3
0
        /// <summary>
        /// The dispose.
        /// </summary>
        public void Dispose()
        {
            if (this._hunspell != null)
            {
                this._hunspell.Dispose();
                this._hunspell = null;
            }

            if (this._spellCheck != null)
            {
                this._spellCheck.Dispose();
                this._spellCheck = null;
            }
        }
コード例 #4
0
        /// <summary>
        /// Initializes a new instance of the <see cref="OcrFixEngine"/> class. 
        /// 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;

            this._spellCheck = new OcrSpellCheck { StartPosition = FormStartPosition.Manual };
            this._spellCheck.Location = new Point(parentForm.Left + (parentForm.Width / 2 - this._spellCheck.Width / 2), parentForm.Top + (parentForm.Height / 2 - this._spellCheck.Height / 2));

            this._ocrFixReplaceList = OcrFixReplaceList.FromLanguageId(threeLetterIsoLanguageName);
            this.LoadSpellingDictionaries(threeLetterIsoLanguageName, hunspellName); // Hunspell etc.

            this.AutoGuessesUsed = new List<string>();
            this.UnknownWordsFound = new List<string>();
        }