示例#1
1
  public String formatOflazer() {
    StringBuilder sb = new StringBuilder();
    sb.append(dictionaryItem.root).append("+");

    int i = 0;
    for (InflectionalGroup ig : inflectionalGroups) {
      if (i == 0) {
        if (ig.pos == PrimaryPos.Adverb) {
          sb.append("Adverb"); // Oflazer uses Adverb, we use Adv
        } else sb.append(ig.pos.shortForm);
        if (ig.spos != null && ig.spos != SecondaryPos.None)
          sb.append("+").append(ig.spos.shortForm);
        if (!ig.suffixList.isEmpty()) sb.append("+");
      } else {
        if (sb.charAt(sb.length() - 1) == '+') {
          sb.deleteCharAt(sb.length() - 1); // delete +
        }
        sb.append("^DB+").append(ig.pos.shortForm).append("+");
      }
      int j = 0;
      for (SuffixData sd : ig.suffixList) {
        String suffixId = sd.suffix.id;
        if (oflazerTable.containsKey(suffixId)) suffixId = oflazerTable.get(suffixId);
        sb.append(suffixId);
        if (j < ig.suffixList.size() - 1) sb.append("+");
        j++;
      }
      i++;
    }
    return sb.toString();
  }
示例#2
1
 public String formatNoEmpty() {
   StringBuilder sb = prefix();
   int j = 0;
   for (SuffixData suffixData : suffixList) {
     if (suffixData.surface.length() == 0) {
       continue;
     }
     if (j > 0 && j < suffixList.size() - 1) sb.append("+");
     sb.append(suffixData.suffix.id);
     j++;
   }
   if (sb.charAt(sb.length() - 1) == ';') sb.deleteCharAt(sb.length() - 1);
   sb.append(")");
   return sb.toString();
 }