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.LanguageDetectorImplementation of the LanguageDetector API that uses https://github.com/optimaize/language-detector
-
-
Field Summary
Fields Modifier and Type Field Description static intDEFAULT_MAX_CHARS_FOR_DETECTIONstatic intDEFAULT_MAX_CHARS_FOR_SHORT_DETECTION
-
Constructor Summary
Constructors Constructor Description OptimaizeLangDetector()OptimaizeLangDetector(int maxCharsForDetection)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddText(char[] cbuf, int off, int len)List<org.apache.tika.language.detect.LanguageResult>detectAll()booleanhasEnoughText()booleanhasModel(String language)org.apache.tika.language.detect.LanguageDetectorloadModels()org.apache.tika.language.detect.LanguageDetectorloadModels(Set<String> languages)voidreset()org.apache.tika.language.detect.LanguageDetectorsetPriors(Map<String,Float> languageProbabilities)
-
-
-
Field Detail
-
DEFAULT_MAX_CHARS_FOR_DETECTION
public static final int DEFAULT_MAX_CHARS_FOR_DETECTION
- See Also:
- Constant Field Values
-
DEFAULT_MAX_CHARS_FOR_SHORT_DETECTION
public static final int DEFAULT_MAX_CHARS_FOR_SHORT_DETECTION
- See Also:
- Constant Field Values
-
-
Method Detail
-
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
public boolean hasModel(String language)
- 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
public List<org.apache.tika.language.detect.LanguageResult> 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
-
-