src/main/java/eu/digitisation/ngram/NgramModel.java
protected void addSubstrings(String context, String text) {
        if (text.length() < 1) {
            throw new IllegalArgumentException("Cannot extract n-grams from empty text");
        }
        String s = context + text;
        // extract all substrings
        for (int high = context.length() + 1; high <= s.length(); ++high) {
            for (int low = Math.max(0, high - order); low < high; ++low) {
                addEntry(s.substring(low, high));
            }
        }
        // the normalization of 1-grams
        addEntries("", text.length());
    }
/**
     * Add all substrings in this string to the NgramModel
     *
     * @param context the preceding context, possibly empty
     * @param text the non-empty input string
     */
Add all substrings in this string to the NgramModel
@param context the preceding context, possibly empty
@param text the non-empty input string
Add all substrings in this string to the NgramModel @param context the preceding context possibly empty @param text the non - empty input string
protected void addSubstrings(String context, String text) {
        if (text.length() < 1) {
            throw new IllegalArgumentException("Cannot extract n-grams from empty text");
        }
        String s = context + text;
        for (int high = context.length() + 1; high <= s.length(); ++high) {
            for (int low = Math.max(0, high - order); low < high; ++low) {
                addEntry(s.substring(low, high));
            }
        }
        addEntries("", text.length());
    }
protected void addSubstrings ( String context , String text ) { if ( text . length ( ) < 1 ) { throw new IllegalArgumentException ( "Cannot extract n-grams from empty text" ) ; } String s = context + text ; for ( int high = context . length ( ) + 1 ; high <= s . length ( ) ; ++ high ) { for ( int low = Math . max ( 0 , high - order ) ; low < high ; ++ low ) { addEntry ( s . substring ( low , high ) ) ; } } addEntries ( "" , text . length ( ) ) ; }
Add all substrings in this string to the NgramModel
 @param context the preceding context, possibly empty
 @param text the non-empty input string
Add all substrings in this string to the NgramModel @param context the preceding context possibly empty @param text the non - empty input string
// extract all substrings // the normalization of 1-grams