How to set short-text profile from Java code
Opened this issue · 1 comments
sagarpatel07 commented
Hello,
I am very happy to used this API, but someone can please let me know how i can used API with short-text profile.
Thanks in Advanced.
Thanks,
Sagar
james-s-w-clark commented
@sagarpatel07 I think my snippet in issue 63 (slightly rewritten here) does what you want:
int shortTextLimit = 100; // 50 by default. Strings shorter than this use the short-text language detection algorithm
List<LanguageProfile> languageProfiles = new LanguageProfileReader().readAllBuiltIn();
LanguageDetector detector = LanguageDetectorBuilder.create(NgramExtractors.standard())
.withProfiles(languageProfiles)
.shortTextAlgorithm(shortTextLimit)
.build();
Does that help you?