Package com.flaptor.hounder.classifier.bayes

Examples of com.flaptor.hounder.classifier.bayes.BayesClassifier


       
    }
   
    public boolean reloadProbabilities(){
        for (String cat: config.getCategoryList()){
            classifiers.put(cat, new BayesClassifier(config.getBaseDir(), cat));
        }
        return true;
    }
View Full Code Here


    }
   
    public Map<String,Map<String, Double>> verify(String catName, boolean loadMaps)
    throws UnsupportedEncodingException{
        if (loadMaps) loadIncludedNotIncludedUrls(catName);
        BayesClassifier classifier= new BayesClassifier(config.getBaseDir(), catName);
        if (classifier.isProbabilitiesFileEmpty()){
            return null;
        }

        Map<String,Map<String, Double>> mp= new HashMap<String,Map<String, Double>>();       
        mp.put("uinc_cinc", new HashMap<String, Double>());
        mp.put("unot_cnot", new HashMap<String, Double>());
        mp.put("uinc_cnot", new HashMap<String, Double>());
        mp.put("unot_cinc", new HashMap<String, Double>());
       
        // traverse the list of included urls and check what the classifier say
        for (String url: includedUrlsList){
            String item=cache.getItem(url);
            if (null==item){
                LOGGER.warn("Page " + url + "is in included for " + catName + " but not in cache");
                continue;
            }
            double classifierScore = classifier.classify(DocumentParser.parse(item, classifier.getMaxTuple()));
            boolean classifierIncluded = (classifierScore > 0.5);
            addToIncNotIncMap(mp, url, true, classifierIncluded, classifierScore);           
        }
        // traverse the list of not included urls and check what the classifier say
        for (String url: notIncludedUrlsList){
            String item=cache.getItem(url);
            if (null==item){
                LOGGER.warn("Page " + url + "is in notIncluded for " + catName + " but not in cache");
                continue;
            }
            double classifierScore = classifier.classify(DocumentParser.parse(item, classifier.getMaxTuple()));
            boolean classifierIncluded = (classifierScore > 0.5);
            addToIncNotIncMap(mp, url, false, classifierIncluded, classifierScore);           
        }
        return mp;
    }
View Full Code Here

TOP

Related Classes of com.flaptor.hounder.classifier.bayes.BayesClassifier

Copyright © 2018 www.massapicom. 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.