Exemplo n.º 1
1
  public String markup(Sentence s) {
    String tmp = "<p style=\"font-size: 20pt\">";

    for (TokWord word : s) {
      String tag = word.getTag("CLS_ANN");
      if (tag != null && !tag.equals("*")) {
        int lCount = 0;
        int rCount = 0;
        for (char ch : tag.toCharArray()) {
          if (ch == '(') {
            lCount++;
          } else if (ch == ')') {
            rCount++;
          }
        }
        for (int i = 0; i < lCount; i++) {
          tmp += "<b><span style=\"color:red\">(</span></b>";
        }
        tmp += word.word();
        for (int i = 0; i < rCount; i++) {
          tmp += "<b><span style=\"color:red\">)</span></b>";
        }
      } else {
        tmp += word.word();
      }
      tmp += " ";
    }
    tmp += "</p>";

    return tmp;
  }
Exemplo n.º 2
1
  public String markup(Sentence s) {
    String tmp = "<p style=\"font-size: 20pt\">";
    int lCount = 0;
    int rCount = 0;
    for (TokWord word : s) {
      if (word.getTag("CLS_BN_S").equals("S")) {
        lCount++;
      }
      if (word.getTag("CLS_BN_E").equals("E")) {
        rCount++;
      }
    }
    for (int i = 0; i < (rCount - lCount); i++) {
      tmp += "<b><span style=\"color:green\">(</span></b>";
    }
    for (TokWord word : s) {
      if (word.getTag("CLS_BN_S").equals("S")) {
        tmp += "<b><span style=\"color:red\">(</span></b>";
      }
      /*if (word.getTag("DIS_CON").equals("O")) tmp += word.word();
      else tmp += "<u><b>" + word.word() + "</b></u>";*/
      tmp += word.word();
      if (word.getTag("CLS_BN_E").equals("E")) {
        tmp += "<b><span style=\"color:red\">)</span></b>";
      }
      tmp += " ";
    }
    for (int i = 0; i < (lCount - rCount); i++) {
      tmp += "<b><span style=\"color:green\">)</span></b>";
    }
    tmp += "</p>";

    return tmp;
  }
Exemplo n.º 3
0
  public String markup(Sentence s) {
    /*
    String tmp = "<p style=\"font-size: 20pt\">";
    int lCount = 0;
    int rCount = 0;
    for (TokWord word : s) {
        if (word.getTag("CLS_BN_S").equals("S")) {
            lCount++;
        }
        if (word.getTag("CLS_BN_E").equals("E")) {
            rCount++;
        }
    }
    for (int i = 0; i < (rCount - lCount); i++) {
        tmp += "<b><span style=\"color:green\">(</span></b>";
    }
    for (TokWord word : s) {
        if (word.getTag("CLS_BN_S").equals("S")) {
            tmp += "<b><span style=\"color:red\">(</span></b>";
        }

        if (word.getTag("Arg") != null) {
            if (word.getTag("Arg").equals("-1")) tmp += "<span style=\"background-color:#CCCCFF\">";
            else if (word.getTag("Arg").equals("-2")) tmp += "<span style=\"background-color:#FFDB94\">";
        }

        tmp += word.word();

        if (word.getTag("Arg") != null && (word.getTag("Arg").equals("1") || word.getTag("Arg").equals("2"))) {
            tmp += "</span>";
        }

        if (word.getTag("CLS_BN_E").equals("E")) {
            tmp += "<b><span style=\"color:red\">)</span></b>";
        }
        tmp += " ";
    }

    for (int i = 0; i < (lCount - rCount); i++) {
        tmp += "<b><span style=\"color:green\">)</span></b>";
    }
    tmp += "</p>";

    return tmp;*/

    String colors[] =
        new String[] {
          "#FF0000", "#DD1100", "#CC2211", "#AA3322", "#884433", "#665544", "446655", "227766"
        };
    String tmp = "<p style=\"font-size: 20pt\">";

    for (TokWord word : s) {

      // set background for argument span
      if (!word.getTag("ARG1S").equals("0")) {
        tmp += "<span style=\"background-color:#CCCCFF\">";
      }
      if (!word.getTag("ARG2S").equals("0")) {
        tmp += "<span style=\"background-color:#FFDB94\">";
      }
      String tag = word.getTag("CLS_ANN");
      if (tag != null && !tag.equals("*")) {
        String sNum[] = word.getTag("CLS_S#").split(":");
        String eNum[] = word.getTag("CLS_E#").split(":");

        for (int i = 0; i < sNum.length; i++) {
          int x = Integer.parseInt(sNum[i]);
          if (x == 0) continue;
          String color = colors[x % colors.length];
          tmp += "<b><span style=\"color:" + color + "\">(</span></b>";
        }

        tmp += word.word();

        for (int i = 0; i < eNum.length; i++) {
          int x = Integer.parseInt(eNum[i]);
          if (x == 0) continue;
          String color = colors[x % colors.length];
          tmp += "<b><span style=\"color:" + color + "\">)</span></b>";
        }
      } else {
        tmp += word.word();
      }
      tmp += " ";
      if (!word.getTag("ARG1E").equals("0") || !word.getTag("ARG2E").equals("0")) {
        tmp += "</span>";
      }
    }
    tmp += "</p>";

    return tmp;
  }