Skip to content

Commit

Permalink
added lang hint for apache-tika (comment out)
Browse files Browse the repository at this point in the history
  • Loading branch information
SrdjanStevanetic committed Nov 28, 2023
1 parent 174d3d7 commit 18d687d
Showing 1 changed file with 14 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,20 @@ public List<String> detectLang(List<String> texts, String langHint) throws Langu
if (texts.isEmpty()) {
return new ArrayList<>();
}

/*
* this code can be used for testing the lang hint, but the setPriors map cannot be sent empty or null
*/
// try {
// Map<String, Float> languageProbabilities = new HashMap<String, Float>();
// if(! StringUtils.isBlank(langHint)) {
// languageProbabilities.put(langHint, (float) 1.0);
// }
// this.detector.setPriors(languageProbabilities);
// } catch (IOException e) {
// throw new LanguageDetectionException(
// "Invalid setting of the language hint for the Apache-Tika service!", -1, e);
// }

List<String> detectedLangs = new ArrayList<String>();
for(String text : texts) {
Expand Down

0 comments on commit 18d687d

Please sign in to comment.