addProfile method
Implementation
void addProfile(LangProfile profile, int index, int langSize) {
String lang = profile.name!;
if (langList.contains(lang)) {
final s = langList.toString();
throw LangDetectException(ErrorCode.duplicateLangError,
'Duplicate the same language profile. $s');
}
langList.add(lang);
profile.freq.forEach((String word, int count) {
if (!wordLangProbMap.containsKey(word)) {
wordLangProbMap[word] = List<double>.filled(langSize, 0.0);
}
int length = word.length;
if (1 <= length && length <= 3) {
double prob = 1.0 * count / profile.nWords[length - 1];
wordLangProbMap[word]![index] = prob;
}
});
}