Examples of SurfaceFormOccurrence


Examples of org.dbpedia.spotlight.model.SurfaceFormOccurrence

      for( KeyPhrase kp: keaPhrases) {
        //System.out.println("KP: " + kp.getPhrase() + " ( Weight: " + kp.getWeight() + " Rank: " + kp.getRank() + ")");
        LOG.debug("Occurrences of kp " + kp.getPhrase() + " are: " + kp.getOffsetslist());
        SurfaceForm surfaceForm = new SurfaceForm(kp.getPhrase());
        for (Integer s: kp.getOffsetslist()) {
          SurfaceFormOccurrence sfocc =  new SurfaceFormOccurrence(surfaceForm, intext, s);
          sfOccurrences.add(sfocc);
        }
      }

    } catch (Exception e) {
View Full Code Here

Examples of org.dbpedia.spotlight.model.SurfaceFormOccurrence

                    System.out.println("Sentence = " + sentence);
                    System.out.println("Text = " + text);
                    */

                    SurfaceForm surfaceForm = new SurfaceForm(surfaceFormStr);
                    SurfaceFormOccurrence sfocc =  new SurfaceFormOccurrence(surfaceForm, text, entStart);
                    sfocc.features().put("type", new Feature("type",oType.toString()));
                    sfOccurrences.add(sfocc);
                }
            }

        }
View Full Code Here

Examples of org.dbpedia.spotlight.model.SurfaceFormOccurrence

        NGram ng = new NGram(txtform, begin, end);
        SurfaceForm surfaceForm = new SurfaceForm(ng.getTextform());

                assert !ng.getTextform().isEmpty();

        SurfaceFormOccurrence sfocc =  new SurfaceFormOccurrence(surfaceForm, text, ng.getStart());
        if (surfaceForm.name().trim().length()>0 && !sfOccurrences.contains(sfocc)) {
          sfOccurrences.add(sfocc);
        }
      }
    }
View Full Code Here

Examples of org.dbpedia.spotlight.model.SurfaceFormOccurrence

            int end = textWithMarkedSurfaceForms.indexOf("]]", start);
            if (end == -1)
                break;
            SurfaceForm sf = new SurfaceForm(textWithMarkedSurfaceForms.substring(start, end));
            int offset = start - (sfOccs.size()*4) - 2;
            SurfaceFormOccurrence sfOcc = new SurfaceFormOccurrence(sf, unMarkedUpText, offset);
            sfOccs.add(sfOcc);
            i = end + 2;
        }
        return sfOccs;
    }
View Full Code Here

Examples of org.dbpedia.spotlight.model.SurfaceFormOccurrence

    List<SurfaceFormOccurrence> surfaceFormOccurrences = new LinkedList<SurfaceFormOccurrence>();

    for(TaggedToken taggedToken : taggedTokens) {

      if(!filterPOS.isOnUnigramBlacklist(taggedToken.getPOSTag())) {
        surfaceFormOccurrences.add(new SurfaceFormOccurrence(new SurfaceForm(taggedToken.getToken()), null, taggedToken.getOffset()));
      }

    }

    return surfaceFormOccurrences;
View Full Code Here

Examples of org.dbpedia.spotlight.model.SurfaceFormOccurrence

    LOG.info(baseResult);

        LOG.info("Reformatting.");
        Map<SurfaceFormOccurrence, AnnotatedSurfaceFormOccurrence> goldSurfaceFormOccurrences = new HashMap<SurfaceFormOccurrence, AnnotatedSurfaceFormOccurrence>();
    for(AnnotatedSurfaceFormOccurrence annotatedSurfaceFormOccurrence : evaluationCorpus.getInstances()) {
            SurfaceFormOccurrence sfo = annotatedSurfaceFormOccurrence.toSurfaceFormOccurrence();
            goldSurfaceFormOccurrences.put(sfo, annotatedSurfaceFormOccurrence);
            //goldSurfaceFormOccurrences.put(getNameVariation(sfo), annotatedSurfaceFormOccurrence);
        }
        List<Text> documents = evaluationCorpus.getTexts();
View Full Code Here

Examples of org.dbpedia.spotlight.model.SurfaceFormOccurrence

            }
        long end = System.currentTimeMillis();
    selectorResult.setTime(end - start);

    for(AnnotatedSurfaceFormOccurrence annotatedSurfaceFormOccurrence : evaluationCorpus.getInstances()) {
            SurfaceFormOccurrence sfo = annotatedSurfaceFormOccurrence.toSurfaceFormOccurrence();
      if(extractedSurfaceFormOccurrences.contains(sfo)) {
                SpotClass c = annotatedSurfaceFormOccurrence.getSpotClass();
                if (c.equals(SpotClass.common))
                    selectorResult.addCommon();
                else if (c.equals(SpotClass.valid))
View Full Code Here

Examples of org.dbpedia.spotlight.model.SurfaceFormOccurrence

        if (sf.toLowerCase().endsWith("[\\.\\,]")) {
            offsetFromEnd = 1;
        }
        int end = sfo.surfaceForm().name().length()-1;
        SurfaceForm variation = new SurfaceForm(sf.substring(offsetFromStart, end-offsetFromEnd).trim());
        return new SurfaceFormOccurrence(variation, sfo.context(), sfo.textOffset()+offsetFromStart, sfo.provenance(), sfo.spotProb());
    }
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.