<commit_before>/*
 * $Date$
 * $Author$
 *
 * Copyright (C) 2002 <NAME>
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License
 * as published by the Free Software Foundation; either version 2
 * of the License, or any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 */
package com.swabunga.spell.jedit;

import com.swabunga.spell.engine.SpellDictionary;
import com.swabunga.spell.engine.SpellDictionaryDisk;
import com.swabunga.spell.engine.SpellDictionaryHashMap;
import com.swabunga.spell.event.SpellCheckListener;
import com.swabunga.spell.event.SpellChecker;
import com.swabunga.spell.event.SpellCheckEvent;
import com.swabunga.spell.event.WordFinder;
import com.swabunga.spell.event.JavaWordFinder;
import com.swabunga.spell.event.TeXWordFinder;
import com.swabunga.spell.event.XMLWordFinder;
import com.swabunga.spell.event.DefaultWordFinder;
import com.swabunga.spell.event.StringWordTokenizer;
import com.swabunga.spell.swing.JSpellDialog;

import java.io.File;
import java.io.InputStream;
import java.io.InputStreamReader;

import org.gjt.sp.jedit.Macros;
import org.gjt.sp.jedit.View;
import org.gjt.sp.jedit.jEdit;
import org.gjt.sp.jedit.textarea.JEditTextArea;
import org.gjt.sp.jedit.textarea.Selection;
import org.gjt.sp.util.Log;


public class JazzySpellCheck
    implements SpellCheckListener {

    //~ Instance/static variables .............................................

    public static final int LOAD_DICTIONARY    = 1;
    public static final int RESET_SPELLCHECKER = 2;
    private boolean LOADED                     = false;
    private JEditTextArea area;
    private int caretPosn;
    private SpellDictionary dictionary;
    private JSpellDialog dlg;
    private int flags;
    private boolean noerrors                   = true;
    private int offset;
    private SpellChecker spellChecker;

    //~ Constructors ..........................................................

    /**
     * Creates a new JazzySpellCheck object.
     * 
     * @param flags 
     */
    public JazzySpellCheck(int flags) {
        this.flags                             = flags;
        
        boolean loadNow = ((flags & LOAD_DICTIONARY) == LOAD_DICTIONARY);

        if (loadNow) {

              Thread t = new Thread() {
                    public void run() {
                        loadDictionary();
                    }
              };
              t.start();
        }

        setupDialog();
    }

    //~ Methods ...............................................................<commit_msg>Added quick hack to make sure that the properties are ignoring words containing numbers.<commit_after>/*
 * $Date$
 * $Author$
 *
 * Copyright (C) 2002 <NAME>
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License
 * as published by the Free Software Foundation; either version 2
 * of the License, or any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 */
package com.swabunga.spell.jedit;

import com.swabunga.spell.engine.SpellDictionary;
import com.swabunga.spell.engine.SpellDictionaryDisk;
import com.swabunga.spell.engine.SpellDictionaryHashMap;
import com.swabunga.spell.engine.Configuration;
import com.swabunga.spell.event.SpellCheckListener;
import com.swabunga.spell.event.SpellChecker;
import com.swabunga.spell.event.SpellCheckEvent;
import com.swabunga.spell.event.WordFinder;
import com.swabunga.spell.event.JavaWordFinder;
import com.swabunga.spell.event.TeXWordFinder;
import com.swabunga.spell.event.XMLWordFinder;
import com.swabunga.spell.event.DefaultWordFinder;
import com.swabunga.spell.event.StringWordTokenizer;
import com.swabunga.spell.swing.JSpellDialog;

import java.io.File;
import java.io.InputStream;
import java.io.InputStreamReader;

import org.gjt.sp.jedit.Macros;
import org.gjt.sp.jedit.View;
import org.gjt.sp.jedit.jEdit;
import org.gjt.sp.jedit.textarea.JEditTextArea;
import org.gjt.sp.jedit.textarea.Selection;
import org.gjt.sp.util.Log;


public class JazzySpellCheck
    implements SpellCheckListener {

    //~ Instance/static variables .............................................

    public static final int LOAD_DICTIONARY    = 1;
    public static final int RESET_SPELLCHECKER = 2;
    private boolean LOADED                     = false;
    private JEditTextArea area;
    private int caretPosn;
    private SpellDictionary dictionary;
    private JSpellDialog dlg;
    private int flags;
    private boolean noerrors                   = true;
    private int offset;
    private SpellChecker spellChecker;
    private Configuration config = Configuration.getConfiguration();

    //~ Constructors ..........................................................

    /**
     * Creates a new JazzySpellCheck object.
     * 
     * @param flags 
     */
    public JazzySpellCheck(int flags) {
        this.flags                             = flags;
        
        boolean loadNow = ((flags & LOAD_DICTIONARY) == LOAD_DICTIONARY);

        if (loadNow) {

              Thread t = new Thread() {
                    public void run() {
                        loadDictionary();
                    }
              };
              t.start();
        }

        
        config.setBoolean(Configuration.SPELL_IGNOREDIGITWORDS, 
                          jEdit.getBooleanProperty("options.jazzy.SPELL_IGNOREDIGITWORDS", false));

        Log.log(Log.MESSAGE,this,"Ignore Digits? "+config.getBoolean(Configuration.SPELL_IGNOREDIGITWORDS));
                          
        setupDialog();
    }

    //~ Methods ...............................................................
{'fraction_non_alphanumeric': 0.1296324538660973, 'fraction_numerical': 0.006405368308677749, 'mean_word_length': 2.345918367346939, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7242950', 'n_tokens_mistral': 1869, 'n_tokens_neox': 1851, 'n_words': 509}