Exemplo n.º 1
0
  public MLInstance(Instance instance, CodeBook codebook) {
    messageID = instance.getMessageId();
    instID = String.valueOf(instance.getId());
    sentence = instance;
    tokens = Arrays.asList(instance.getTokens());
    posTags = Arrays.asList(sentence.getPOSTags());
    // what is this for unlabeled
    // check for null or empty list
    classLabels = instance.getCodes();
    // check if classLabels is null
    // get codebook from docID

    humanLabels = new ArrayList<String>();
    String humanLabel;
    if (classLabels != null) {
      for (String label : classLabels) {
        humanLabel = codebook.getLabel(label);
        humanLabels.add(humanLabel);
      }
    }
    // document level data
    docSender = instance.getMessageFrom();

    // silver instance information

    if (instance.getInstanceType() == InstanceType.SILVER) {
      isSilverCollection = true;
      silverCode = instance.getSilverCode();
      // check these labels, is one unverified?
      silverVerificationLabel = instance.getVerificationType();
    }
  }
Exemplo n.º 2
0
  /*
   *  This constructor for use with gold documents from repository with tokens and labels
   *     (possibly null) sender
   */
  public MLInstance(
      String messageID,
      String sentID,
      Instance sentence,
      List<String> toks,
      List<String> labels,
      List<String> humanLabels,
      String docSender) {
    this.messageID = messageID;
    instID = sentID;
    this.sentence = sentence;
    tokens = toks;
    // assume that the Instance class returns the tokens and pos tags in order
    this.posTags = Arrays.asList(sentence.getPOSTags());
    classLabels = labels;
    this.humanLabels = humanLabels;
    this.docSender = docSender;

    isSilverCollection = false;
  }
Exemplo n.º 3
0
 /*
  *  This constructor for use with silver instances from repository with tokens and verified codes
  *     (possibly null) sender
  */
 public MLInstance(
     String messageID,
     String sentID,
     Instance sentence,
     List<String> toks,
     String code,
     VerificationType label,
     String docSender) {
   this.messageID = messageID;
   instID = sentID;
   this.sentence = sentence;
   tokens = toks;
   // assume that the Instance class returns the tokens and pos tags in order
   this.posTags = Arrays.asList(sentence.getPOSTags());
   silverVerificationLabel = label;
   silverCode = code;
   this.docSender = docSender;
   // class label list is empty
   classLabels = new ArrayList<String>();
   isSilverCollection = true;
 }