Package org.dbpedia.spotlight.tagging

Examples of org.dbpedia.spotlight.tagging.TaggedToken


  /**
   * Test the retrieval of the left neighbour of a term candidate.
   */
  public void testGetLeftNeigbour() throws ItemNotFoundException {
    TaggedToken leftNeighbour = lingPipeTaggedTokenProvider1.getLeftNeighbourToken(28, 45);
    assertEquals("44-year-old", leftNeighbour.getToken());
  }
View Full Code Here


  /**
   * Test the retrieval of the right neighbour of a term candidate.
   */
  public void testGetRightNeigbour() throws ItemNotFoundException {
    TaggedToken rightNeighbour = lingPipeTaggedTokenProvider1.getRightNeighbourToken(28, 45);
    assertEquals(",", rightNeighbour.getToken());
  }
View Full Code Here

  /**
   * Test the retrieval of the right neighbour of a term candidate.
   */
  public void testGetRightNeigbour2() throws ItemNotFoundException {
    TaggedToken rightNeighbour = lingPipeTaggedTokenProvider1.getRightNeighbourToken(326, 343);
    assertEquals("\"", rightNeighbour.getToken());
  }
View Full Code Here

    assertEquals("jj", tokens2.get(0).getPOSTag());
    assertEquals("jj", tokens3.get(0).getPOSTag());
  }

  public void testGetLeftNeighbour() throws ItemNotFoundException {
    TaggedToken leftNeighbourToken = lingPipeTaggedTokenProvider1.getLeftNeighbourToken(17, 19);
   
    assertEquals("a", leftNeighbourToken.getToken());
  }
View Full Code Here

    assertEquals("a", leftNeighbourTokens.get(0).getToken());
  }


  public void testGetRightNeighbour() throws ItemNotFoundException {
    TaggedToken leftNeighbourToken = lingPipeTaggedTokenProvider1.getRightNeighbourToken(17, 19);

    assertEquals("real", leftNeighbourToken.getToken());
  }
View Full Code Here

           * verb, etc.
           */


          if(Character.isUpperCase(surfaceFormOccurrence.surfaceForm().name().charAt(0))){
            TaggedToken taggedToken = ((TaggedText) surfaceFormOccurrence.context()).taggedTokenProvider().getTaggedTokens(surfaceFormOccurrence).get(0);

            /**
             * Add uppercase adjectives (e.g. Canadian tv star)
             */
            if(taggedToken.getPOSTag() != null && taggedToken.getPOSTag().startsWith("j"))
              selectedOccurrences.add(surfaceFormOccurrence);

          }else{
            decisions.add("Dropped by POS filter: " + surfaceFormOccurrence);

View Full Code Here

      }


      Tagging<String> tags = posTagger.tag(tokenList.subList(sentStartToken, sentEndToken + 1));
      for (int j = 0; j < tags.size(); j++) {
        TaggedToken taggedToken = new TaggedToken(tags.token(j), whiteList.get(sentStartToken + j + 1), tags.tag(j), textOffset, null);
        taggedTokens.add(taggedToken);
        textOffset += tokens[sentStartToken + j].length() + whites[sentStartToken + j + 1].length();
      }

      sentStartToken = sentEndToken + 1;
View Full Code Here

          .getLeftNeighbourToken(surfaceFormOccurrence).getToken();
    } catch (ItemNotFoundException e) {
      return 0;
    }

    TaggedToken rightNeighbour = null;
    try {
      rightNeighbour = ((TaggedText) surfaceFormOccurrence.context()).taggedTokenProvider()
          .getRightNeighbourToken(surfaceFormOccurrence);
    } catch (ItemNotFoundException e) {
      return 0;
    }

    return leftNeighbourToken.matches(QUOTE_PATTERN) && (rightNeighbour.getToken().matches(QUOTE_PATTERN) || rightNeighbour.getPOSTag().matches(PRE_QUOTE_PUNC)) ? 1 : 0;

  }
View Full Code Here

   * @param surfaceFormOccurrence the surface form in context
   * @return is surface form followed by preposition?
   */
  public static int followedByPrep(SurfaceFormOccurrence surfaceFormOccurrence) {

    TaggedToken rightNeighbourToken = null;
    try {
      rightNeighbourToken = ((TaggedText) surfaceFormOccurrence.context()).taggedTokenProvider()
          .getRightNeighbourToken(surfaceFormOccurrence);
    } catch (ItemNotFoundException e) {
      return 0;
    }

    if (rightNeighbourToken.getPOSTag().equals("in"))
      return 1;
    else
      return 0;


View Full Code Here

   *
   * @param surfaceFormOccurrence the surface form in context
   * @return POS tag of the previous token
   */
  public static Integer prePOS(SurfaceFormOccurrence surfaceFormOccurrence) {
    TaggedToken leftNeighbour = null;

    try {
      leftNeighbour = ((TaggedText) surfaceFormOccurrence.context()).taggedTokenProvider()
          .getLeftNeighbourToken(surfaceFormOccurrence);
    } catch (ItemNotFoundException e) {
      return null;
    }

    TaggedToken rightNeighbour = null;
    try {
      rightNeighbour = ((TaggedText) surfaceFormOccurrence.context()).taggedTokenProvider()
          .getRightNeighbourToken(surfaceFormOccurrence);
    } catch (ItemNotFoundException e) {

    }


    if (leftNeighbour.getPOSTag().equals("pp$") && (rightNeighbour != null && rightNeighbour.getPOSTag().equals("in")))
      return 0;
    else if (leftNeighbour.getToken().equals("of"))
      return 2;
    else if (leftNeighbour.getPOSTag().equals("in"))
      return 1;
View Full Code Here

TOP

Related Classes of org.dbpedia.spotlight.tagging.TaggedToken

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.