Class OptimaizeLangDetector
java.lang.Object
org.apache.tika.language.detect.LanguageDetector
org.apache.tika.langdetect.optimaize.OptimaizeLangDetector
public class OptimaizeLangDetector
extends org.apache.tika.language.detect.LanguageDetector
Implementation of the LanguageDetector API that uses
https://github.com/optimaize/language-detector
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intstatic final intFields inherited from class org.apache.tika.language.detect.LanguageDetector
mixedLanguages, shortText -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddText(char[] cbuf, int off, int len) List<org.apache.tika.language.detect.LanguageResult>booleanbooleanorg.apache.tika.language.detect.LanguageDetectororg.apache.tika.language.detect.LanguageDetectorloadModels(Set<String> languages) voidreset()org.apache.tika.language.detect.LanguageDetectorMethods inherited from class org.apache.tika.language.detect.LanguageDetector
addText, detect, detect, detectAll, getDefaultLanguageDetector, getLanguageDetectors, getLanguageDetectors, isMixedLanguages, isShortText, setMixedLanguages, setShortText
-
Field Details
-
DEFAULT_MAX_CHARS_FOR_DETECTION
public static final int DEFAULT_MAX_CHARS_FOR_DETECTION- See Also:
-
DEFAULT_MAX_CHARS_FOR_SHORT_DETECTION
public static final int DEFAULT_MAX_CHARS_FOR_SHORT_DETECTION- See Also:
-
-
Constructor Details
-
OptimaizeLangDetector
public OptimaizeLangDetector() -
OptimaizeLangDetector
public OptimaizeLangDetector(int maxCharsForDetection)
-
-
Method Details
-
loadModels
public org.apache.tika.language.detect.LanguageDetector loadModels()- Specified by:
loadModelsin classorg.apache.tika.language.detect.LanguageDetector
-
loadModels
public org.apache.tika.language.detect.LanguageDetector loadModels(Set<String> languages) throws IOException - Specified by:
loadModelsin classorg.apache.tika.language.detect.LanguageDetector- Throws:
IOException
-
hasModel
- Specified by:
hasModelin classorg.apache.tika.language.detect.LanguageDetector
-
setPriors
public org.apache.tika.language.detect.LanguageDetector setPriors(Map<String, Float> languageProbabilities) throws IOException- Specified by:
setPriorsin classorg.apache.tika.language.detect.LanguageDetector- Throws:
IOException
-
reset
public void reset()- Specified by:
resetin classorg.apache.tika.language.detect.LanguageDetector
-
addText
public void addText(char[] cbuf, int off, int len) - Specified by:
addTextin classorg.apache.tika.language.detect.LanguageDetector
-
detectAll
- Specified by:
detectAllin classorg.apache.tika.language.detect.LanguageDetector- Returns:
- the detected list of languages
- Throws:
IllegalStateException- if no models have been loaded withloadModels()orloadModels(java.util.Set)
-
hasEnoughText
public boolean hasEnoughText()- Overrides:
hasEnoughTextin classorg.apache.tika.language.detect.LanguageDetector
-