Package org.dbpedia.spotlight.model

Examples of org.dbpedia.spotlight.model.DBpediaResourceOccurrence


        this.mixture = mixture;
    }

    @Override
    public DBpediaResourceOccurrence disambiguate(SurfaceFormOccurrence sfOcc) throws SearchException, ItemNotFoundException, InputException {
        DBpediaResourceOccurrence resultOcc = null;

        List<DBpediaResourceOccurrence> bestKsuper = super.bestK(sfOcc, Integer.MAX_VALUE);

        double best = -Double.MAX_VALUE;
        double second;
        for(DBpediaResourceOccurrence occ : bestKsuper) {
            double mixedScore = mixture.getScore(occ);
            if(mixedScore > best) {
                second = best;
                best = mixedScore;
                resultOcc = occ;
                resultOcc.setSimilarityScore(mixedScore);
                if(second > -Double.MAX_VALUE) {
                    resultOcc.setPercentageOfSecondRank(second/best);
                }
            }
        }

        if(resultOcc == null) {
View Full Code Here


        }

        Collections.sort(bestK, new SimScoreComparator());

        for(int i=1; i < bestK.size(); i++) {
            DBpediaResourceOccurrence top = bestK.get(i-1);
            DBpediaResourceOccurrence bottom = bestK.get(i);
            top.setPercentageOfSecondRank(bottom.similarityScore()/top.similarityScore()); //TODO similarityScore or contextualScore??
        }

        return bestK;
    }
View Full Code Here

     * @param r
     * @throws IndexException
     */
    public void add(DBpediaResourceOccurrence r) throws IndexException {
        //TODO FIXME quick hack to run overnight.
        addOccurrence(new DBpediaResourceOccurrence(r.resource(), new SurfaceForm(r.surfaceForm().name().toLowerCase()), r.context(), r.textOffset(), r.provenance()));
        //addOccurrence(r);
        numEntriesIndexed++;
    }
View Full Code Here

TOP

Related Classes of org.dbpedia.spotlight.model.DBpediaResourceOccurrence

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.