Examples of detect()


Examples of com.cybozu.labs.langdetect.Detector.detect()

    }

    private String detectLanguage(String text) throws LangDetectException, IOException {
        Detector detector = DetectorFactory.create();
        detector.append(text);
        String lang = detector.detect();
        if (lang.length() == 0) {
            return null;
        }
        return lang;
    }
View Full Code Here

Examples of com.cybozu.labs.langdetect.Detector.detect()

        DetectorFactory.loadProfile("language_detect");
        isLoadLanguageProfile = true;
      }
      Detector detector = DetectorFactory.create();
      detector.append(title);
      lang = detector.detect();
    } catch (LangDetectException e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
    }
    int type = 1;
View Full Code Here

Examples of com.ibm.icu.text.CharsetDetector.detect()

        if (charset == null) {
          CharsetDetector det = new CharsetDetector();
          det.enableInputFilter(true);
          InputStream detStream = new BufferedInputStream(sourceStream);
          det.setText(detStream);
          charset = det.detect().getName();
          sourceStream = detStream;
        }
       
        // wtf? still nothing, just take system-standard
        if (charset == null) {
View Full Code Here

Examples of com.ibm.icu.text.CharsetDetector.detect()

  }

  public String autoDetectEncoding(byte[] bytes) {
    CharsetDetector cd = new CharsetDetector();
    cd.setText(bytes);
    CharsetMatch charsetMatch = cd.detect();
    String charSet = charsetMatch.getName();

    int confidence = charsetMatch.getConfidence();
    logger.info("CharsetMatch: {} ({}% confidence)", charSet, confidence);
    setSelectedItem(charSet);
View Full Code Here

Examples of com.ibm.icu.text.CharsetDetector.detect()

            stream = new BufferedInputStream(stream);
        }
   
        detector.setText(stream);
   
        CharsetMatch match = detector.detect();
        if (match == null) {
            throw new TikaException("Unable to detect character encoding");
        }
       
        metadata.set(Metadata.CONTENT_ENCODING, match.getName());
View Full Code Here

Examples of com.salas.bb.utils.discovery.detector.XMLFormatDetector.detect()

        {
            uis = new URLInputStream(source, System.getProperty("http.agent.discoverer"));
            uis.setRedirectionListener(listener);

            XMLFormatDetector detector = new XMLFormatDetector();
            XMLFormat fmt = detector.detect(uis);

            detected = fmt != null && fmt != XMLFormat.OPML;
        } catch (IOException e)
        {
            throw new UrlDiscovererException(e);
View Full Code Here

Examples of edu.purdue.wind.CrackDetector.detect()

  double probingFreq = Double.parseDouble(args[1]);
  detector.processAudio(t.blade(0), data[0], probingFreq);
  detector.processAudio(t.blade(1), data[1], probingFreq);

  if (detector.detect(t.blade(0), t.blade(1))) {
      System.out.println("Crack detected");
  } else {
      System.out.println("No cracks");
  }
    }
View Full Code Here

Examples of org.apache.tika.Tika.detect()

    public static String getMimeTypeWithByteBuffer(java.nio.ByteBuffer buffer) throws IOException {
        byte[] b = buffer.array();

        Tika tika = new Tika();
        return tika.detect(b);
    }

    public static String buildRequestPrefix(Delegator delegator, Locale locale, String webSiteId, String https) {
        Map<String, Object> prefixValues = FastMap.newInstance();
        String prefix;
View Full Code Here

Examples of org.apache.tika.Tika.detect()

    public static String getMimeTypeWithByteBuffer(java.nio.ByteBuffer buffer) throws IOException {
        byte[] b = buffer.array();

        Tika tika = new Tika();
        return tika.detect(b);
    }

    public static String buildRequestPrefix(Delegator delegator, Locale locale, String webSiteId, String https) {
        Map<String, Object> prefixValues = FastMap.newInstance();
        String prefix;
View Full Code Here

Examples of org.apache.tika.detect.ContainerAwareDetector.detect()

         new ContainerAwareDetector(MimeTypes.getDefaultMimeTypes());
     
      try {
         assertEquals(
                 MediaType.application("vnd.ms-tnef"),
                 detector.detect(stream, new Metadata()));
     } finally {
         stream.close();
     }
   }
  
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.