Examples of Detector


Examples of com.cybozu.labs.langdetect.Detector

    try {
      if (!isLoadLanguageProfile) {
        DetectorFactory.loadProfile("language_detect");
        isLoadLanguageProfile = true;
      }
      Detector detector = DetectorFactory.create();
      detector.append(title);
      lang = detector.detect();
    } catch (LangDetectException e) {
      e.printStackTrace();
    }
    int type = 1;
    if (lang.equalsIgnoreCase("en")) {
View Full Code Here

Examples of com.cybozu.labs.langdetect.Detector

     */
    public String detect(ServiceContext srvContext, String input) throws Exception {
        if(!LanguageDetector.languageLevelSupported) {
            throw new Exception(LanguageDetector.upgradeMessage);
        }
        Detector detector = DetectorFactory.create();
        detector.append(input);
        String detectedLanguage = detector.detect()
        // this is to deal with zh-cn and zh-tw in languageprofiles. All other files have a 639-1 2-char filename.
        if(detectedLanguage.length() > 2) {
            detectedLanguage = detectedLanguage.substring(0, 2);
        }
        String iso639_2 = srvContext.getBean(IsoLanguagesMapper.class).iso639_1_to_iso639_2(detectedLanguage);
View Full Code Here

Examples of com.cybozu.labs.langdetect.Detector

    try {
      if (!isLoadLanguageProfile) {
        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.cybozu.labs.langdetect.Detector

        DetectorFactory.loadProfile(profileDirectory);
    }
   
    // isLanguage("The quick brown fox.", "en")
    public boolean isLanguage(String text, String langAbbr) {
        Detector detector;
        boolean isLang = false;
        try {
            detector = DetectorFactory.create();
            detector.append(text);
            isLang = detector.detect().startsWith(langAbbr);
        } catch (LangDetectException e) {
            //System.out.println("Could not detect language on: " + text);
        }
       
       
View Full Code Here

Examples of com.cybozu.labs.langdetect.Detector

        }
        return profiles;
    }
   
    public String getLanguage(String text) throws LangDetectException {
        Detector detector = DetectorFactory.create();
        detector.append(text);
        return detector.detect();
    }
View Full Code Here

Examples of com.cybozu.labs.langdetect.Detector

        detector.append(text);
        return detector.detect();
    }
   
    public ArrayList<Language> getLanguages(String text) throws LangDetectException {
        Detector detector = DetectorFactory.create();
        detector.append(text);
        return detector.getProbabilities();
    }
View Full Code Here

Examples of kilim.analysis.Detector

    static int err = 0;

    public static void main(String[] args) throws IOException {
//        System.out.println(System.getProperty("java.class.path"));
     
      Detector detector = Detector.DEFAULT;
     
        String currentName = null;
        for (String name : parseArgs(args)) {
            try {
                if (name.endsWith(".class")) {
View Full Code Here

Examples of kilim.mirrors.Detector

    }

    public ArrayList<MethodFlow> analyze(boolean forceAnalysis) throws KilimException {
        // cr.accept(this, ClassReader.SKIP_DEBUG);

        Detector save = Detector.setDetector(detector);
        try {
            cr.accept(this, /*flags*/ClassReader.SKIP_FRAMES);
            for (Object o : this.fields) {
                FieldNode fn = (FieldNode) o;
                if (fn.name.equals(Constants.WOVEN_FIELD)) {
View Full Code Here

Examples of kilim.mirrors.Detector

     * @see #weave(List) for run-time weaving.
     */
    public static void main(String[] args) throws IOException {
        // System.out.println(System.getProperty("java.class.path"));

        Detector detector = Detector.DEFAULT;

        String currentName = null;
        for (String name : parseArgs(args)) {
            try {
                if (name.endsWith(".class")) {
View Full Code Here

Examples of kilim.mirrors.Detector

        this(Thread.currentThread().getContextClassLoader());
    }
   
    public Weaver(ClassLoader cl) {
        mirrors = new CachedClassMirrors(cl);
        detector = new Detector(mirrors);
    }
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.