Package eu.hlavki.text.lemmagen.impl

Examples of eu.hlavki.text.lemmagen.impl.DefaultLemmatizer


                if (file.getName().endsWith(".tbl")) {
                    BufferedReader br = null;
                    try {
                        br = new BufferedReader(new FileReader(file));
                        log.info("Reading " + file.getName());
                        DefaultLemmatizer lm = new DefaultLemmatizer(br, "WLM", settings);
                        log.info("Building " + file.getName());
                        lm.buildModel();
                        String filename = file.getName().substring(0, file.getName().lastIndexOf("."));
                        log.info("Saving to " + filename + ".lem");
                        LemmatizerFactory.saveToFile(lm, new File(dir, filename + ".lem"));
                    } finally {
                        try {
View Full Code Here


            InputStream in = TrainTest.class.getResourceAsStream(TEST_DICTIONARY);
            BufferedReader br = new BufferedReader(new InputStreamReader(in, "UTF-8"));

            System.out.println("Building model...");
            DefaultLemmatizer lm = new DefaultLemmatizer(br, format, settings);
            lm.buildModel();

            System.out.println("Model built");

            System.out.println("Saving model...");
            LemmatizerFactory.saveToFile(lm, tmpLemFile);
            System.out.println("Model saved.");

            assertLemmaEquals(lm, ACTUAL_WORDS, LEMMA_WORDS);

            System.out.println("Clearing examples...");
            lm.clearExamples();
            System.out.println("Examples clear...");

            System.out.println("Reading model from file");
            lm = (DefaultLemmatizer) LemmatizerFactory.readFromFile(tmpLemFile);
View Full Code Here

        Lemmatizer retVal = null;
        ObjectInputStream ois = null;
        try {
            GZIPInputStream zis = new GZIPInputStream(in);
            ois = new ObjectInputStream(zis);
            retVal = new DefaultLemmatizer(ois);
            ois.close();
        } finally {
            try {
                if (ois != null) ois.close();
            } catch (IOException e) {
View Full Code Here

TOP

Related Classes of eu.hlavki.text.lemmagen.impl.DefaultLemmatizer

Copyright © 2018 www.massapicom. 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.