Example #1
0
 private static char[] transcodeRemaining(char c2, char c3, char c4, char c5) {
     if (c3 == 'E' && c4 == 'V') {
         return CHARS_AF;
     }
     if (Nysiis.isVowel(c3)) {
         return CHARS_A;
     }
     if (c3 == 'Q') {
         return CHARS_G;
     }
     if (c3 == 'Z') {
         return CHARS_S;
     }
     if (c3 == 'M') {
         return CHARS_N;
     }
     if (c3 == 'K') {
         if (c4 == 'N') {
             return CHARS_NN;
         }
         return CHARS_C;
     }
     if (c3 == 'S' && c4 == 'C' && c5 == 'H') {
         return CHARS_SSS;
     }
     if (c3 == 'P' && c4 == 'H') {
         return CHARS_FF;
     }
     if (!(c3 != 'H' || Nysiis.isVowel(c2) && Nysiis.isVowel(c4))) {
         return new char[]{c2};
     }
     if (c3 == 'W' && Nysiis.isVowel(c2)) {
         return new char[]{c2};
     }
     return new char[]{c3};
 }
Example #2
0
 /*
  * Enabled aggressive block sorting
  */
 public String nysiis(String charSequence) {
     int n2;
     void var1_3;
     if (charSequence == null) {
         return var1_3;
     }
     String string2 = SoundexUtils.clean(charSequence);
     if (string2.length() == 0) {
         return string2;
     }
     String string3 = PAT_MAC.matcher(string2).replaceFirst("MCC");
     String string4 = PAT_KN.matcher(string3).replaceFirst("NN");
     String string5 = PAT_K.matcher(string4).replaceFirst("C");
     String string6 = PAT_PH_PF.matcher(string5).replaceFirst("FF");
     String string7 = PAT_SCH.matcher(string6).replaceFirst("SSS");
     String string8 = PAT_EE_IE.matcher(string7).replaceFirst("Y");
     String string9 = PAT_DT_ETC.matcher(string8).replaceFirst("D");
     StringBuilder stringBuilder = new StringBuilder(string9.length());
     stringBuilder.append(string9.charAt(0));
     string9 = (String)string9.toCharArray();
     int n3 = string9.length;
     for (n2 = 1; n2 < n3; ++n2) {
         Object object = n2 < n3 - 1 ? (Object)string9[n2 + 1] : 32;
         Object object2 = n2 < n3 - 2 ? (Object)string9[n2 + 2] : 32;
         char[] arrc = Nysiis.transcodeRemaining((char)string9[n2 - 1], (char)string9[n2], (char)object, (char)object2);
         System.arraycopy(arrc, 0, string9, n2, arrc.length);
         if (string9[n2] == string9[n2 - 1]) continue;
         stringBuilder.append((char)string9[n2]);
     }
     if (stringBuilder.length() > 1) {
         n2 = n3 = (int)stringBuilder.charAt(stringBuilder.length() - 1);
         if (n3 == 83) {
             stringBuilder.deleteCharAt(stringBuilder.length() - 1);
             n2 = stringBuilder.charAt(stringBuilder.length() - 1);
         }
         if (stringBuilder.length() > 2 && stringBuilder.charAt(stringBuilder.length() - 2) == 'A' && n2 == 89) {
             stringBuilder.deleteCharAt(stringBuilder.length() - 2);
         }
         if (n2 == 65) {
             stringBuilder.deleteCharAt(stringBuilder.length() - 1);
         }
     }
     String string10 = string9 = stringBuilder.toString();
     if (!this.isStrict()) {
         return var1_3;
     }
     return string9.substring(0, Math.min(6, string9.length()));
 }