Examples of HSpellLoader


Examples of com.code972.hebmorph.hspell.HSpellLoader

public abstract class TestBase {
    private static DictHebMorph dict;

    protected synchronized DictHebMorph getDictionary(boolean allowHeHasheela) throws IOException {
        if (dict == null) {
            DictRadix<MorphData> radix = new HSpellLoader(new File(HSpellLoader.getHspellPath()), true).loadDictionaryFromHSpellData();
            HashMap<String, Integer> prefs = null;
            if (allowHeHasheela) {
                prefs = HSpellLoader.readPrefixesFromFile(HSpellLoader.getHspellPath() + HSpellLoader.PREFIX_H);
            } else {
                prefs = HSpellLoader.readPrefixesFromFile(HSpellLoader.getHspellPath() + HSpellLoader.PREFIX_NOH);
View Full Code Here

Examples of com.code972.hebmorph.hspell.HSpellLoader

public abstract class TestBase {
    private static DictHebMorph dict;

    protected synchronized DictHebMorph getDictionary(boolean allowHeHasheela) throws IOException {
        if (dict == null) {
            DictRadix<MorphData> radix = new HSpellLoader(new File(HSpellLoader.getHspellPath()), true).loadDictionaryFromHSpellData();
            HashMap<String, Integer> prefs = null;
            if (allowHeHasheela) {
                prefs = HSpellLoader.readPrefixesFromFile(HSpellLoader.getHspellPath() + HSpellLoader.PREFIX_H);
            } else {
                prefs = HSpellLoader.readPrefixesFromFile(HSpellLoader.getHspellPath() + HSpellLoader.PREFIX_NOH);
View Full Code Here

Examples of com.code972.hebmorph.hspell.HSpellLoader

        return synonymMap.build();
    }

    static private DictRadix<MorphData> loadFromClasspath(final String pathInClasspath) {
        try {
            HSpellLoader loader = new HSpellLoader(Thread.currentThread().getContextClassLoader(), pathInClasspath, true);
            return loader.loadDictionaryFromHSpellData();
        } catch (IOException ex) {
            try {
                // Try to use environment variable if failed with classpath
                return loadFromEnvVariable();
            } catch (IOException e) {
View Full Code Here

Examples of com.code972.hebmorph.hspell.HSpellLoader

        }
    }

    static private DictRadix<MorphData> loadFromPath(final File path) {
        try {
            HSpellLoader loader = new HSpellLoader(path, true);
            return loader.loadDictionaryFromHSpellData();
        } catch (IOException ex) {
            throw new IllegalStateException("Failed to read data", ex);
        }
    }
View Full Code Here

Examples of com.code972.hebmorph.hspell.HSpellLoader

        String hspellPath = System.getenv(DEFAULT_HSPELL_ENV_VARIABLE);
        if (hspellPath == null) {
            throw new IllegalStateException("Failed to load hspell dictionary files. They should be configured " +
                    "in classpath or by " + DEFAULT_HSPELL_ENV_VARIABLE + " environment variable");
        }
        HSpellLoader loader = new HSpellLoader(new File(hspellPath), true);
        return loader.loadDictionaryFromHSpellData();
    }
View Full Code Here

Examples of com.code972.hebmorph.hspell.HSpellLoader

public abstract class BaseTokenStreamWithDictionaryTestCase extends BaseTokenStreamTestCase {
    private static DictHebMorph dict;

    protected synchronized DictHebMorph getDictionary(boolean allowHeHasheela) throws IOException {
        if (dict == null) {
            DictRadix<MorphData> radix = new HSpellLoader(new File(HSpellLoader.getHspellPath()), true).loadDictionaryFromHSpellData();
            HashMap<String, Integer> prefs = null;
            if (allowHeHasheela) {
                prefs = HSpellLoader.readPrefixesFromFile(HSpellLoader.getHspellPath() + HSpellLoader.PREFIX_H);
            } else {
                prefs = HSpellLoader.readPrefixesFromFile(HSpellLoader.getHspellPath() + HSpellLoader.PREFIX_NOH);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.