public final class NgramFrequencyData extends Object
Immutable by definition (can't make Arrays unmodifiable).
| Modifier and Type | Method and Description |
|---|---|
static NgramFrequencyData |
create(Collection<LanguageProfile> languageProfiles,
Collection<Integer> gramLengths) |
LdLocale |
getLanguage(int pos) |
List<LdLocale> |
getLanguageList() |
double[] |
getProbabilities(String ngram)
Don't modify this data structure! (Can't make array immutable...)
|
@NotNull public static NgramFrequencyData create(@NotNull Collection<LanguageProfile> languageProfiles, @NotNull Collection<Integer> gramLengths) throws IllegalArgumentException
gramLengths - for example [1,2,3]IllegalArgumentException - if languageProfiles or gramLengths is empty, or if one of the
languageProfiles does not have the grams of the required sizes.@NotNull public LdLocale getLanguage(int pos)
@Nullable public double[] getProbabilities(String ngram)
getLanguageList() language list, and has exactly that size.
impl note: this way the caller can handle it more efficient than returning an empty array.Copyright © 2015. All rights reserved.