Package org.wikipedia.miner.model

Examples of org.wikipedia.miner.model.Anchor


      double wikipKeyphraseness = 0;
      if (vocabularyName.equals("wikipedia")) {
        wikipKeyphraseness = candidate.getWikipKeyphraseness()
      } else {
        Anchor anchor = null;
        try {
          anchor = new Anchor(wikipedia.getDatabase()
              .addEscapes(original), null, wikipedia.getDatabase());
          if (anchor != null) {
            if (anchor.getLinkProbability() != 0) {
              wikipKeyphraseness = anchor.getLinkProbability();
            }
          }
        } catch (SQLException e) {
          System.err.println("Error retrieving the anchor for " + candidate);
        //  e.printStackTrace();
View Full Code Here


                  // this is the first occurrence of this
                  // candidate
                  // create a candidate object

                  if (vocabularyName.equals("wikipedia")) {
                    Anchor anchor;
                    try {
                      anchor = new Anchor(form,
                          textProcessor, wikipedia
                          .getDatabase());
                      double probability = anchor.getLinkProbability();
                      if (probability >= minKeyphraseness) {
                        // add this candidate to the
                        // list
                        countCandidates++;
                        totalFrequency++;
View Full Code Here

    // probability
    SortedVector<Article> bestCandidateSenses = new SortedVector<Article>();

    for (Candidate candidate : candidates) {

      Anchor anchor = candidate.getAnchor();
      try {

        // if required number of context articles
        // is reached, break
        if (context.size() >= maxContextSize) {
          break;
        }

        if (anchor.getSenses().isEmpty()) {
          continue;
        }

        // what is the most likely sense for the given candidate
        Sense bestSense = anchor.getSenses().first();

        // add to the context all articles that map
        // from ngrams with one possible meaning
        // = non-ambiguous meanings
        // and high probability of being links in Wikipedia
        if (anchor.getSenses().size() == 1
            && anchor.getLinkProbability() > 0.5) {
          context.add(bestSense);
          continue;
        }

        // in case if not enough non-ambigious terms were collected
        // additionally collect other mappings based on:

        // a. likelihood of the sense
        double senseProbability = bestSense.getProbability();

        // b. keyphraseness
        double linkProbability = anchor.getLinkProbability();

        if (senseProbability >= 0.9 && linkProbability > 0.5) {
          bestSense.setWeight(senseProbability);
          bestCandidateSenses.add(bestSense, false);
        }
View Full Code Here

TOP

Related Classes of org.wikipedia.miner.model.Anchor

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.