src/main/java/eu/digitisation/ngram/NgramModel.java
public void addWords(File file, Charset encoding, boolean caseSensitive) {
        try {
            WordScanner scanner = new WordScanner(file, encoding, "^\\p{Space}+");
            String word;
            while ((word = scanner.nextWord()) != null) {
                if (caseSensitive) {
                    addWord(word);
                } else {
                    addWord(word.toLowerCase());
                }
            }
        } catch (IOException ex) {
            Messages.info(NgramModel.class
                    .getName() + ": " + ex);
        }
    }
/**
     * Reads text file and adds the words in text to model.
     *
     * @param file a text file
     * @param encoding the text encoding
     * @param caseSensitive true if extracted n-grams are case sensitive
     */
Reads text file and adds the words in text to model.
@param file a text file
@param encoding the text encoding
@param caseSensitive true if extracted n-grams are case sensitive
Reads text file and adds the words in text to model . @param file a text file @param encoding the text encoding @param caseSensitive true if extracted n - grams are case sensitive
public void addWords(File file, Charset encoding, boolean caseSensitive) {
        try {
            WordScanner scanner = new WordScanner(file, encoding, "^\\p{Space}+");
            String word;
            while ((word = scanner.nextWord()) != null) {
                if (caseSensitive) {
                    addWord(word);
                } else {
                    addWord(word.toLowerCase());
                }
            }
        } catch (IOException ex) {
            Messages.info(NgramModel.class
                    .getName() + ": " + ex);
        }
    }
public void addWords ( File file , Charset encoding , boolean caseSensitive ) { try { WordScanner scanner = new WordScanner ( file , encoding , "^\\p{Space}+" ) ; String word ; while ( ( word = scanner . nextWord ( ) ) != null ) { if ( caseSensitive ) { addWord ( word ) ; } else { addWord ( word . toLowerCase ( ) ) ; } } } catch ( IOException ex ) { Messages . info ( NgramModel . class . getName ( ) + ": " + ex ) ; } }
Reads text file and adds the words in text to model.
Reads text file and adds the words in text to model .