⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 doublemeta.java

📁 自动拼写检查的实现
💻 JAVA
📖 第 1 页 / 共 2 页
字号:
              current += 3;
              break;
            } else {
              MetaphAdd(primary, "TK");
              current += 2;
              break;
            }
          }
          MetaphAdd(primary, 'T');
          if (stringAt(in, current, 2, list32)) {
            current += 2;
          } else {
            current += 1;
          }
          break;
        case 'F':
          if (in.charAt(current + 1) == 'F')
            current += 2;
          else
            current += 1;
          MetaphAdd(primary, 'F');
          break;
        case 'G':
          if (in.charAt(current + 1) == 'H') {
            if ((current > 0) && !isVowel(in, current - 1, length)) {
              MetaphAdd(primary, 'K');
              current += 2;
              break;
            }
            if (current < 3) {
              if (current == 0) {
                if (in.charAt(current + 2) == 'I')
                  MetaphAdd(primary, 'J');
                else
                  MetaphAdd(primary, 'K');
                current += 2;
                break;
              }
            }
            if ((current > 1) && stringAt(in, current - 2, 1, list33) || ((current > 2) && stringAt(in, current - 3, 1, list34)) || ((current > 3) && stringAt(in, current - 4, 1, list35))) {
              current += 2;
              break;
            } else {
              if ((current > 2) && (in.charAt(current - 1) == 'U') && stringAt(in, current - 3, 1, list36)) {
                MetaphAdd(primary, 'F');
              } else {
                if ((current > 0) && (in.charAt(current - 1) != 'I'))
                  MetaphAdd(primary, 'K');
              }
              current += 2;
              break;
            }
          }
          if (in.charAt(current + 1) == 'N') {
            if ((current == 1) && isVowel(in, 0, length) && !isSlavoGermaic) {
              MetaphAdd(primary, "KN");
            } else {
              if (!stringAt(in, current + 2, 2, list37) && (in.charAt(current + 1) != 'Y') && !isSlavoGermaic) {
                MetaphAdd(primary, "N");
              } else {
                MetaphAdd(primary, "KN");
              }
            }
            current += 2;
            break;
          }
          if (stringAt(in, current + 1, 2, list38) && !isSlavoGermaic) {
            MetaphAdd(primary, "KL");
            current += 2;
            break;
          }
          if ((current == 0) && ((in.charAt(current + 1) == 'Y') || stringAt(in, current + 1, 2, list39))) {
            MetaphAdd(primary, 'K');
            current += 2;
            break;
          }
          if ((stringAt(in, current + 1, 2, list40) || (in.charAt(current + 1) == 'Y')) && !stringAt(in, 0, 6, list41) && !stringAt(in, current - 1, 1, list42) && !stringAt(in, current - 1, 3, list43)) {
            MetaphAdd(primary, 'K');
            current += 2;
            break;
          }
          if (stringAt(in, current + 1, 1, list44) || stringAt(in, current - 1, 4, list45)) {
            if (stringAt(in, 0, 4, list46) || stringAt(in, 0, 3, list47) || stringAt(in, current + 1, 2, list48)) {
              MetaphAdd(primary, 'K');
            } else {
              MetaphAdd(primary, 'J');
            }
            current += 2;
            break;
          }
          if (in.charAt(current + 1) == 'G')
            current += 2;
          else
            current += 1;
          MetaphAdd(primary, 'K');
          break;
        case 'H':
          if (((current == 0) || isVowel(in, current - 1, length)) && isVowel(in, current + 1, length)) {
            MetaphAdd(primary, 'H');
            current += 2;
          } else {
            current += 1;
          }
          break;
        case 'J':
          if (stringAt(in, current, 4, list50) || stringAt(in, 0, 4, list51)) {
            if ((current == 0) && (in.charAt(current + 4) == ' ') || stringAt(in, 0, 4, list52)) {
              MetaphAdd(primary, 'H');
            } else {
              MetaphAdd(primary, 'J');
            }
            current += 1;
            break;
          }
          if ((current == 0) && !stringAt(in, current, 4, list53)) {
            MetaphAdd(primary, 'J');
          } else {
            if (isVowel(in, current - 1, length) && !isSlavoGermaic && ((in.charAt(current + 1) == 'A') || in.charAt(current + 1) == 'O')) {
              MetaphAdd(primary, 'J');
            } else {
              if (current == last) {
                MetaphAdd(primary, 'J');
              } else {
                if (!stringAt(in, current + 1, 1, list54) && !stringAt(in, current - 1, 1, list55)) {
                  MetaphAdd(primary, 'J');
                }
              }
            }
          }
          if (in.charAt(current + 1) == 'J')
            current += 2;
          else
            current += 1;
          break;
        case 'K':
          if (in.charAt(current + 1) == 'K')
            current += 2;
          else
            current += 1;
          MetaphAdd(primary, 'K');
          break;
        case 'L':
          if (in.charAt(current + 1) == 'L') {
            if (((current == (length - 3)) && stringAt(in, current - 1, 4, list56)) || ((stringAt(in, last - 1, 2, list57) || stringAt(in, last, 1, list58)) && stringAt(in, current - 1, 4, list59))) {
              MetaphAdd(primary, 'L');
              current += 2;
              break;
            }
            current += 2;
          } else
            current += 1;
          MetaphAdd(primary, 'L');
          break;
        case 'M':
          if ((stringAt(in, current - 1, 3, list60) && (((current + 1) == last) || stringAt(in, current + 2, 2, list61))) || (in.charAt(current + 1) == 'M'))
            current += 2;
          else
            current += 1;
          MetaphAdd(primary, 'M');
          break;
        case 'N':
          if (in.charAt(current + 1) == 'N')
            current += 2;
          else
            current += 1;
          MetaphAdd(primary, 'N');
          break;
        case '\u00D1':
          current += 1;
          MetaphAdd(primary, 'N');
          break;
        case 'P':
          if (in.charAt(current + 1) == 'N') {
            MetaphAdd(primary, 'F');
            current += 2;
            break;
          }
          if (stringAt(in, current + 1, 1, list62))
            current += 2;
          else
            current += 1;
          MetaphAdd(primary, 'P');
          break;
        case 'Q':
          if (in.charAt(current + 1) == 'Q')
            current += 2;
          else
            current += 1;
          MetaphAdd(primary, 'K');
          break;
        case 'R':
          if ((current == last) && !isSlavoGermaic && stringAt(in, current - 2, 2, list63) && !stringAt(in, current - 4, 2, list64)) {
//            MetaphAdd(primary, "");
          } else
            MetaphAdd(primary, 'R');
          if (in.charAt(current + 1) == 'R')
            current += 2;
          else
            current += 1;
          break;
        case 'S':
          if (stringAt(in, current - 1, 3, list65)) {
            current += 1;
            break;
          }
          if ((current == 0) && stringAt(in, current, 5, list66)) {
            MetaphAdd(primary, 'X');
            current += 1;
            break;
          }
          if (stringAt(in, current, 2, list67)) {
            if (stringAt(in, current + 1, 4, list68))
              MetaphAdd(primary, 'S');
            else
              MetaphAdd(primary, 'X');
            current += 2;
            break;
          }
          if (stringAt(in, current, 3, list69) || stringAt(in, current, 4, list70)) {
            MetaphAdd(primary, 'S');
            current += 3;
            break;
          }
          if (((current == 0) && stringAt(in, current + 1, 1, list71)) || stringAt(in, current + 1, 1, list72)) {
            MetaphAdd(primary, 'S');
            if (stringAt(in, current + 1, 1, list73))
              current += 2;
            else
              current += 1;
            break;
          }
          if (stringAt(in, current, 2, list74)) {
            if (in.charAt(current + 2) == 'H')
              if (stringAt(in, current + 3, 2, list75)) {
                if (stringAt(in, current + 3, 2, list76)) {
                  MetaphAdd(primary, "X");
                } else {
                  MetaphAdd(primary, "SK");
                }
                current += 3;
                break;
              } else {
                MetaphAdd(primary, 'X');
                current += 3;
                break;
              }
            if (stringAt(in, current + 2, 1, list77)) {
              MetaphAdd(primary, 'S');
              current += 3;
              break;
            }
            MetaphAdd(primary, "SK");
            current += 3;
            break;
          }
          if ((current == last) && stringAt(in, current - 2, 2, list78)) {
            //MetaphAdd(primary, "");
          } else
            MetaphAdd(primary, 'S');
          if (stringAt(in, current + 1, 1, list79))
            current += 2;
          else
            current += 1;
          break;
        case 'T':
          if (stringAt(in, current, 4, list80)) {
            MetaphAdd(primary, 'X');
            current += 3;
            break;
          }
          if (stringAt(in, current, 3, list81)) {
            MetaphAdd(primary, 'X');
            current += 3;
            break;
          }
          if (stringAt(in, current, 2, list82) || stringAt(in, current, 3, list83)) {
            if (stringAt(in, (current + 2), 2, list84) || stringAt(in, 0, 4, list85) || stringAt(in, 0, 3, list86)) {
              MetaphAdd(primary, 'T');
            } else {
              MetaphAdd(primary, '0');
            }
            current += 2;
            break;
          }
          if (stringAt(in, current + 1, 1, list87)) {
            current += 2;
          } else
            current += 1;
          MetaphAdd(primary, 'T');
          break;
        case 'V':
          if (in.charAt(current + 1) == 'V')
            current += 2;
          else
            current += 1;
          MetaphAdd(primary, 'F');
          break;
        case 'W':
          if (stringAt(in, current, 2, list88)) {
            MetaphAdd(primary, 'R');
            current += 2;
            break;
          }
          if ((current == 0) && (isVowel(in, current + 1, length) || stringAt(in, current, 2, list89))) {
            MetaphAdd(primary, 'A');
          }
          if (((current == last) && isVowel(in, current - 1, length)) || stringAt(in, current - 1, 5, list90) || stringAt(in, 0, 3, list91)) {
            MetaphAdd(primary, 'F');
            current += 1;
            break;
          }
          if (stringAt(in, current, 4, list92)) {
            MetaphAdd(primary, "TS");
            current += 4;
            break;
          }
          current += 1;
          break;
        case 'X':
          if (!((current == last) && (stringAt(in, current - 3, 3, list93) || stringAt(in, current - 2, 2, list94))))
            MetaphAdd(primary, "KS");
          if (stringAt(in, current + 1, 1, list95))
            current += 2;
          else
            current += 1;
          break;
        case 'Z':
          if (in.charAt(current + 1) == 'H') {
            MetaphAdd(primary, 'J');
            current += 2;
            break;
          } else {
            MetaphAdd(primary, 'S');
          }
          if (in.charAt(current + 1) == 'Z')
            current += 2;
          else
            current += 1;
          break;
        default:
          current += 1;
      }
    }
    return primary.toString();
  }

  /**
   * @see com.swabunga.spell.engine.Transformator#getReplaceList()
   */
  public char[] getReplaceList() {
    return replaceList;
  }
}



⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -