public final class NgramFrequencyData extends Object
Immutable by definition (can't make Arrays unmodifiable).
Modifier and Type | Method and Description |
---|---|
static @NotNull NgramFrequencyData |
create(@NotNull Collection<LanguageProfile> languageProfiles,
@NotNull Collection<Integer> gramLengths) |
@NotNull LdLocale |
getLanguage(int pos) |
@NotNull List<LdLocale> |
getLanguageList() |
@Nullable double[] |
getProbabilities(String ngram)
Don't modify this data structure! (Can't make array immutable...)
|
@NotNull public static @NotNull NgramFrequencyData create(@NotNull @NotNull Collection<LanguageProfile> languageProfiles, @NotNull @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 @NotNull LdLocale getLanguage(int pos)
@Nullable public @Nullable 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 © 2019. All rights reserved.