Exemplo n.º 1
0
  public static ClassMention createClauseMention(String clauseTypeLabel, String tagSet) {
    ClassMention cm = new DefaultClassMention(ClassMentionType.CLAUSE.typeName());

    if (clauseTypeLabel != null) {
      /* create phraseType slot */
      StringSlotMention sm = new DefaultStringSlotMention(SlotMentionType.CLAUSE_TYPE.typeName());
      sm.addSlotValue(clauseTypeLabel);
      if (tagSet == null) {
        tagSet = UNKNOWN_TAGSET;
      }
      StringSlotMention tagSetSlot =
          new DefaultStringSlotMention(SlotMentionType.TAGSET.typeName());
      tagSetSlot.addSlotValue(tagSet);
      cm.addPrimitiveSlotMention(sm);
      cm.addPrimitiveSlotMention(tagSetSlot);
    }
    return cm;
  }
Exemplo n.º 2
0
  /**
   * Given a part of speech label, stem, lemma, and token number, create a <code>ClassMention</code>
   * that represents a token.
   *
   * @param posLabel part of speech label
   * @param stem the stem of the token
   * @param lemma the lemma of the token
   * @param tokenNumber the token number of the token
   * @return a <code>ClassMention</code> representing a token
   * @throws Exception
   */
  public static ClassMention createTokenMention(
      String posLabel, String posTagSet, String stem, String lemma, Integer tokenNumber) {
    ClassMention cm = new DefaultClassMention(ClassMentionType.TOKEN.typeName());

    if (posLabel != null) {
      /* create POS slot */
      StringSlotMention sm =
          new DefaultStringSlotMention(SlotMentionType.TOKEN_PARTOFSPEECH.typeName());
      sm.addSlotValue(posLabel);

      if (posTagSet == null) {
        posTagSet = UNKNOWN_TAGSET;
      }
      StringSlotMention tagSetSlot =
          new DefaultStringSlotMention(SlotMentionType.TAGSET.typeName());
      tagSetSlot.addSlotValue(posTagSet);
      cm.addPrimitiveSlotMention(sm);
      cm.addPrimitiveSlotMention(tagSetSlot);
    }

    StringSlotMention sm;
    if (stem != null) {
      /* create stem slot */
      sm = new DefaultStringSlotMention(SlotMentionType.TOKEN_STEM.typeName());
      sm.addSlotValue(stem);
      cm.addPrimitiveSlotMention(sm);
    }
    if (lemma != null) {
      /* create lemma slot */
      sm = new DefaultStringSlotMention(SlotMentionType.TOKEN_LEMMA.typeName());
      sm.addSlotValue(lemma);
      cm.addPrimitiveSlotMention(sm);
    }
    if (tokenNumber != null) {
      /* create tokenNumber slot */
      IntegerSlotMention ism =
          new DefaultIntegerSlotMention(SlotMentionType.TOKEN_NUMBER.typeName());
      ism.addSlotValue(tokenNumber);
      cm.addPrimitiveSlotMention(ism);
    }
    return cm;
  }