Class OptimaizeDetector

  • All Implemented Interfaces:
    Detector

    public class OptimaizeDetector
    extends java.lang.Object
    implements Detector
    Detects the language of some sample text using SimpleDetector for CJK and Optimaize otherwise.
    Author:
    bratseth
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      Detection detect​(byte[] input, int offset, int length, Hint hint)
      Detects language and encoding of the supplied byte array, possibly using a language/encoding hint.
      Detection detect​(java.lang.String input, Hint hint)
      Detects language of the supplied String, possibly using a language hint.
      Detection detect​(java.nio.ByteBuffer input, Hint hint)
      Detects language and encoding of the supplied ByteBuffer, possibly using a language/encoding hint.
      Language guessLanguage​(java.lang.String input)  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • OptimaizeDetector

        public OptimaizeDetector()
    • Method Detail

      • detect

        public Detection detect​(byte[] input,
                                int offset,
                                int length,
                                Hint hint)
        Description copied from interface: Detector
        Detects language and encoding of the supplied byte array, possibly using a language/encoding hint.
        Specified by:
        detect in interface Detector
        Parameters:
        input - the buffer that is to be inspected
        offset - the offset to detect from
        length - the size to detect from
        hint - a hint to the detector, or null for no hint
        Returns:
        an array of possible language/encoding pairs, sorted by decreasing confidence (possibly empty, but never null)
      • detect

        public Detection detect​(java.nio.ByteBuffer input,
                                Hint hint)
        Description copied from interface: Detector
        Detects language and encoding of the supplied ByteBuffer, possibly using a language/encoding hint.
        Specified by:
        detect in interface Detector
        Parameters:
        input - the buffer that is to be inspected, from its current position to its limit
        hint - a hint to the detector, or null for no hint
        Returns:
        an array of possible language/encoding pairs, sorted by decreasing confidence (possibly empty, but never null)
      • detect

        public Detection detect​(java.lang.String input,
                                Hint hint)
        Description copied from interface: Detector
        Detects language of the supplied String, possibly using a language hint.
        Specified by:
        detect in interface Detector
        Parameters:
        input - the string that is to be inspected
        hint - a hint to the detector, or null for no hint
        Returns:
        an array of possible language/encoding pairs, sorted by decreasing confidence (possibly empty, but never null)
      • guessLanguage

        public Language guessLanguage​(java.lang.String input)