1 /*******************************************************************************
2 * Copyright (c) 2000, 2003 IBM Corporation and others.
3 * All rights reserved. This program and the accompanying materials
4 * are made available under the terms of the Common Public License v1.0
5 * which accompanies this distribution, and is available at
6 * http://www.eclipse.org/legal/cpl-v10.html
9 * IBM Corporation - initial API and implementation
10 *******************************************************************************/
12 package net.sourceforge.phpdt.internal.ui.text.spelling.engine;
15 * Default phonetic hash provider for english languages.
17 * This algorithm uses an adapted version double metaphone algorithm by Lawrence
23 public final class DefaultPhoneticHashProvider implements IPhoneticHashProvider {
25 private static final String[] meta01 = { "ACH", "" }; //$NON-NLS-1$ //$NON-NLS-2$
27 private static final String[] meta02 = { "BACHER", "MACHER", "" }; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
29 private static final String[] meta03 = { "CAESAR", "" }; //$NON-NLS-1$ //$NON-NLS-2$
31 private static final String[] meta04 = { "CHIA", "" }; //$NON-NLS-1$ //$NON-NLS-2$
33 private static final String[] meta05 = { "CH", "" }; //$NON-NLS-1$ //$NON-NLS-2$
35 private static final String[] meta06 = { "CHAE", "" }; //$NON-NLS-1$ //$NON-NLS-2$
37 private static final String[] meta07 = { "HARAC", "HARIS", "" }; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
39 private static final String[] meta08 = { "HOR", "HYM", "HIA", "HEM", "" }; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$
41 private static final String[] meta09 = { "CHORE", "" }; //$NON-NLS-1$ //$NON-NLS-2$
43 private static final String[] meta10 = { "VAN ", "VON ", "" }; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
45 private static final String[] meta11 = { "SCH", "" }; //$NON-NLS-1$ //$NON-NLS-2$
47 private static final String[] meta12 = { "ORCHES", "ARCHIT", "ORCHID", "" }; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
49 private static final String[] meta13 = { "T", "S", "" }; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
51 private static final String[] meta14 = { "A", "O", "U", "E", "" }; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$
53 private static final String[] meta15 = {
54 "L", "R", "N", "M", "B", "H", "F", "V", "W", " ", "" }; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$ //$NON-NLS-7$ //$NON-NLS-8$ //$NON-NLS-9$ //$NON-NLS-10$ //$NON-NLS-11$
56 private static final String[] meta16 = { "MC", "" }; //$NON-NLS-1$ //$NON-NLS-2$
58 private static final String[] meta17 = { "CZ", "" }; //$NON-NLS-1$ //$NON-NLS-2$
60 private static final String[] meta18 = { "WICZ", "" }; //$NON-NLS-1$ //$NON-NLS-2$
62 private static final String[] meta19 = { "CIA", "" }; //$NON-NLS-1$ //$NON-NLS-2$
64 private static final String[] meta20 = { "CC", "" }; //$NON-NLS-1$ //$NON-NLS-2$
66 private static final String[] meta21 = { "I", "E", "H", "" }; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
68 private static final String[] meta22 = { "HU", "" }; //$NON-NLS-1$ //$NON-NLS-2$
70 private static final String[] meta23 = { "UCCEE", "UCCES", "" }; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
72 private static final String[] meta24 = { "CK", "CG", "CQ", "" }; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
74 private static final String[] meta25 = { "CI", "CE", "CY", "" }; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
76 private static final String[] meta26 = { "GN", "KN", "PN", "WR", "PS", "" }; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$
78 private static final String[] meta27 = { " C", " Q", " G", "" }; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
80 private static final String[] meta28 = { "C", "K", "Q", "" }; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
82 private static final String[] meta29 = { "CE", "CI", "" }; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
84 private static final String[] meta30 = { "DG", "" }; //$NON-NLS-1$ //$NON-NLS-2$
86 private static final String[] meta31 = { "I", "E", "Y", "" }; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
88 private static final String[] meta32 = { "DT", "DD", "" }; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
90 private static final String[] meta33 = { "B", "H", "D", "" }; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
92 private static final String[] meta34 = { "B", "H", "D", "" }; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
94 private static final String[] meta35 = { "B", "H", "" }; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
96 private static final String[] meta36 = { "C", "G", "L", "R", "T", "" }; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$
98 private static final String[] meta37 = { "EY", "" }; //$NON-NLS-1$ //$NON-NLS-2$
100 private static final String[] meta38 = { "LI", "" }; //$NON-NLS-1$ //$NON-NLS-2$
102 private static final String[] meta39 = {
103 "ES", "EP", "EB", "EL", "EY", "IB", "IL", "IN", "IE", "EI", "ER", "" }; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$ //$NON-NLS-7$ //$NON-NLS-8$ //$NON-NLS-9$ //$NON-NLS-10$ //$NON-NLS-11$ //$NON-NLS-12$
105 private static final String[] meta40 = { "ER", "" }; //$NON-NLS-1$ //$NON-NLS-2$
107 private static final String[] meta41 = { "DANGER", "RANGER", "MANGER", "" }; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
109 private static final String[] meta42 = { "E", "I", "" }; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
111 private static final String[] meta43 = { "RGY", "OGY", "" }; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
113 private static final String[] meta44 = { "E", "I", "Y", "" }; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
115 private static final String[] meta45 = { "AGGI", "OGGI", "" }; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
117 private static final String[] meta46 = { "VAN ", "VON ", "" }; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
119 private static final String[] meta47 = { "SCH", "" }; //$NON-NLS-1$ //$NON-NLS-2$
121 private static final String[] meta48 = { "ET", "" }; //$NON-NLS-1$ //$NON-NLS-2$
123 private static final String[] meta49 = { "C", "X", "" }; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
125 private static final String[] meta50 = { "JOSE", "" }; //$NON-NLS-1$ //$NON-NLS-2$
127 private static final String[] meta51 = { "SAN ", "" }; //$NON-NLS-1$ //$NON-NLS-2$
129 private static final String[] meta52 = { "SAN ", "" }; //$NON-NLS-1$ //$NON-NLS-2$
131 private static final String[] meta53 = { "JOSE", "" }; //$NON-NLS-1$ //$NON-NLS-2$
133 private static final String[] meta54 = {
134 "L", "T", "K", "S", "N", "M", "B", "Z", "" }; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$ //$NON-NLS-7$ //$NON-NLS-8$ //$NON-NLS-9$
136 private static final String[] meta55 = { "S", "K", "L", "" }; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
138 private static final String[] meta56 = { "ILLO", "ILLA", "ALLE", "" }; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
140 private static final String[] meta57 = { "AS", "OS", "" }; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
142 private static final String[] meta58 = { "A", "O", "" }; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
144 private static final String[] meta59 = { "ALLE", "" }; //$NON-NLS-1$ //$NON-NLS-2$
146 private static final String[] meta60 = { "UMB", "" }; //$NON-NLS-1$ //$NON-NLS-2$
148 private static final String[] meta61 = { "ER", "" }; //$NON-NLS-1$ //$NON-NLS-2$
150 private static final String[] meta62 = { "P", "B", "" }; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
152 private static final String[] meta63 = { "IE", "" }; //$NON-NLS-1$ //$NON-NLS-2$
154 private static final String[] meta64 = { "ME", "MA", "" }; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
156 private static final String[] meta65 = { "ISL", "YSL", "" }; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
158 private static final String[] meta66 = { "SUGAR", "" }; //$NON-NLS-1$ //$NON-NLS-2$
160 private static final String[] meta67 = { "SH", "" }; //$NON-NLS-1$ //$NON-NLS-2$
162 private static final String[] meta68 = { "HEIM", "HOEK", "HOLM", "HOLZ", "" }; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$
164 private static final String[] meta69 = { "SIO", "SIA", "" }; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
166 private static final String[] meta70 = { "SIAN", "" }; //$NON-NLS-1$ //$NON-NLS-2$
168 private static final String[] meta71 = { "M", "N", "L", "W", "" }; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$
170 private static final String[] meta72 = { "Z", "" }; //$NON-NLS-1$ //$NON-NLS-2$
172 private static final String[] meta73 = { "Z", "" }; //$NON-NLS-1$ //$NON-NLS-2$
174 private static final String[] meta74 = { "SC", "" }; //$NON-NLS-1$ //$NON-NLS-2$
176 private static final String[] meta75 = {
177 "OO", "ER", "EN", "UY", "ED", "EM", "" }; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$ //$NON-NLS-7$
179 private static final String[] meta76 = { "ER", "EN", "" }; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
181 private static final String[] meta77 = { "I", "E", "Y", "" }; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
183 private static final String[] meta78 = { "AI", "OI", "" }; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
185 private static final String[] meta79 = { "S", "Z", "" }; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
187 private static final String[] meta80 = { "TION", "" }; //$NON-NLS-1$ //$NON-NLS-2$
189 private static final String[] meta81 = { "TIA", "TCH", "" }; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
191 private static final String[] meta82 = { "TH", "" }; //$NON-NLS-1$ //$NON-NLS-2$
193 private static final String[] meta83 = { "TTH", "" }; //$NON-NLS-1$ //$NON-NLS-2$
195 private static final String[] meta84 = { "OM", "AM", "" }; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
197 private static final String[] meta85 = { "VAN ", "VON ", "" }; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
199 private static final String[] meta86 = { "SCH", "" }; //$NON-NLS-1$ //$NON-NLS-2$
201 private static final String[] meta87 = { "T", "D", "" }; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
203 private static final String[] meta88 = { "WR", "" }; //$NON-NLS-1$ //$NON-NLS-2$
205 private static final String[] meta89 = { "WH", "" }; //$NON-NLS-1$ //$NON-NLS-2$
207 private static final String[] meta90 = {
208 "EWSKI", "EWSKY", "OWSKI", "OWSKY", "" }; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$
210 private static final String[] meta91 = { "SCH", "" }; //$NON-NLS-1$ //$NON-NLS-2$
212 private static final String[] meta92 = { "WICZ", "WITZ", "" }; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
214 private static final String[] meta93 = { "IAU", "EAU", "" }; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
216 private static final String[] meta94 = { "AU", "OU", "" }; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
218 private static final String[] meta95 = { "W", "K", "CZ", "WITZ" }; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
220 /** The mutator characters */
221 private static final char[] MUTATOR_CHARACTERS = { 'A', 'B', 'X', 'S', 'K',
222 'J', 'T', 'F', 'H', 'L', 'M', 'N', 'P', 'R', '0' };
224 /** The vowel characters */
225 private static final char[] VOWEL_CHARACTERS = new char[] { 'A', 'E', 'I',
229 * Test whether the specified string contains one of the candidates in the
233 * Array of candidates to check
235 * The token to check for occurrences of the candidates
237 * The offset where to begin checking in the string
239 * The length of the range in the string to check
240 * @return <code>true</code> iff the string contains one of the
241 * candidates, <code>false</code> otherwise.
243 protected static final boolean hasOneOf(final String[] candidates,
244 final char[] token, final int offset, final int length) {
246 if (offset < 0 || offset >= token.length || candidates.length == 0)
249 final String checkable = new String(token, offset, length);
250 for (int index = 0; index < candidates.length; index++) {
252 if (candidates[index].equals(checkable))
259 * Test whether the specified token contains one of the candidates in the
263 * Array of candidates to check
265 * The token to check for occurrences of the candidates
266 * @return <code>true</code> iff the string contains one of the
267 * candidates, <code>false</code> otherwise.
269 protected static final boolean hasOneOf(final String[] candidates,
270 final String token) {
272 for (int index = 0; index < candidates.length; index++) {
274 if (token.indexOf(candidates[index]) >= 0)
281 * Tests whether the specified token contains a vowel at the specified
285 * The token to check for a vowel
287 * The offset where to begin checking in the token
289 * The length of the range in the token to check
290 * @return <code>true</code> iff the token contains a vowel,
291 * <code>false</code> otherwise.
293 protected static final boolean hasVowel(final char[] token,
294 final int offset, final int length) {
296 if (offset >= 0 && offset < length) {
298 final char character = token[offset];
299 for (int index = 0; index < VOWEL_CHARACTERS.length; index++) {
301 if (VOWEL_CHARACTERS[index] == character)
309 * @see org.eclipse.spelling.done.IPhoneticHasher#getHash(java.lang.String)
311 public final String getHash(final String word) {
313 final String input = word.toUpperCase() + " "; //$NON-NLS-1$
314 final char[] hashable = input.toCharArray();
316 final boolean has95 = hasOneOf(meta95, input);
317 final StringBuffer buffer = new StringBuffer(hashable.length);
320 if (hasOneOf(meta26, hashable, 0, 2))
323 if (hashable[0] == 'X') {
328 while (offset < hashable.length) {
330 switch (hashable[offset]) {
343 if (hashable[offset + 1] == 'B')
350 && !hasVowel(hashable, offset - 2, hashable.length)
351 && hasOneOf(meta01, hashable, (offset - 1), 3)
352 && (hashable[offset + 2] != 'I')
353 && (hashable[offset + 2] != 'E')
354 || hasOneOf(meta02, hashable, (offset - 2), 6)) {
359 if ((offset == 0) && hasOneOf(meta03, hashable, offset, 6)) {
364 if (hasOneOf(meta04, hashable, offset, 4)) {
369 if (hasOneOf(meta05, hashable, offset, 2)) {
370 if ((offset > 0) && hasOneOf(meta06, hashable, offset, 4)) {
376 && hasOneOf(meta07, hashable, (offset + 1), 5)
377 || hasOneOf(meta08, hashable, offset + 1, 3)
378 && !hasOneOf(meta09, hashable, 0, 5)) {
383 if (hasOneOf(meta10, hashable, 0, 4)
384 || hasOneOf(meta11, hashable, 0, 3)
385 || hasOneOf(meta12, hashable, offset - 2, 6)
386 || hasOneOf(meta13, hashable, offset + 2, 1)
387 || (hasOneOf(meta14, hashable, offset - 1, 1) || (offset == 0))
388 && hasOneOf(meta15, hashable, offset + 2, 1)) {
392 if (hasOneOf(meta16, hashable, 0, 2))
403 if (hasOneOf(meta17, hashable, offset, 2)
404 && !hasOneOf(meta18, hashable, offset, 4)) {
409 if (hasOneOf(meta19, hashable, offset, 2)) {
414 if (hasOneOf(meta20, hashable, offset, 2)
415 && !((offset == 1) && hashable[0] == 'M')) {
416 if (hasOneOf(meta21, hashable, offset + 2, 1)
417 && !hasOneOf(meta22, hashable, offset + 2, 2)) {
418 if (((offset == 1) && (hashable[offset - 1] == 'A'))
419 || hasOneOf(meta23, hashable, (offset - 1), 5))
420 buffer.append("KS"); //$NON-NLS-1$
431 if (hasOneOf(meta24, hashable, offset, 2)) {
435 } else if (hasOneOf(meta25, hashable, offset, 2)) {
441 if (hasOneOf(meta27, hashable, offset + 1, 2))
443 else if (hasOneOf(meta28, hashable, offset + 1, 1)
444 && !hasOneOf(meta29, hashable, offset + 1, 2))
454 if (hasOneOf(meta30, hashable, offset, 2)) {
455 if (hasOneOf(meta31, hashable, offset + 2, 1)) {
460 buffer.append("TK"); //$NON-NLS-1$
466 if (hasOneOf(meta32, hashable, offset, 2)) {
473 if (hashable[offset + 1] == 'F')
480 if (hashable[offset + 1] == 'H') {
482 && !hasVowel(hashable, offset - 1, hashable.length)) {
489 if (hashable[offset + 2] == 'I')
498 && hasOneOf(meta33, hashable, offset - 2, 1)
499 || ((offset > 2) && hasOneOf(meta34, hashable,
501 || ((offset > 3) && hasOneOf(meta35, hashable,
506 if ((offset > 2) && (hashable[offset - 1] == 'U')
507 && hasOneOf(meta36, hashable, offset - 3, 1)) {
510 if ((offset > 0) && (hashable[offset - 1] != 'I'))
517 if (hashable[offset + 1] == 'N') {
518 if ((offset == 1) && hasVowel(hashable, 0, hashable.length)
520 buffer.append("KN"); //$NON-NLS-1$
522 if (!hasOneOf(meta37, hashable, offset + 2, 2)
523 && (hashable[offset + 1] != 'Y') && !has95) {
524 buffer.append("N"); //$NON-NLS-1$
526 buffer.append("KN"); //$NON-NLS-1$
532 if (hasOneOf(meta38, hashable, offset + 1, 2) && !has95) {
533 buffer.append("KL"); //$NON-NLS-1$
538 && ((hashable[offset + 1] == 'Y') || hasOneOf(meta39,
539 hashable, offset + 1, 2))) {
544 if ((hasOneOf(meta40, hashable, offset + 1, 2) || (hashable[offset + 1] == 'Y'))
545 && !hasOneOf(meta41, hashable, 0, 6)
546 && !hasOneOf(meta42, hashable, offset - 1, 1)
547 && !hasOneOf(meta43, hashable, offset - 1, 3)) {
552 if (hasOneOf(meta44, hashable, offset + 1, 1)
553 || hasOneOf(meta45, hashable, offset - 1, 4)) {
554 if (hasOneOf(meta46, hashable, 0, 4)
555 || hasOneOf(meta47, hashable, 0, 3)
556 || hasOneOf(meta48, hashable, offset + 1, 2)) {
564 if (hashable[offset + 1] == 'G')
571 if (((offset == 0) || hasVowel(hashable, offset - 1,
573 && hasVowel(hashable, offset + 1, hashable.length)) {
581 if (hasOneOf(meta50, hashable, offset, 4)
582 || hasOneOf(meta51, hashable, 0, 4)) {
583 if ((offset == 0) && (hashable[offset + 4] == ' ')
584 || hasOneOf(meta52, hashable, 0, 4)) {
592 if ((offset == 0) && !hasOneOf(meta53, hashable, offset, 4)) {
595 if (hasVowel(hashable, offset - 1, hashable.length)
597 && ((hashable[offset + 1] == 'A') || hashable[offset + 1] == 'O')) {
600 if (offset == (hashable.length - 1)) {
603 if (!hasOneOf(meta54, hashable, offset + 1, 1)
604 && !hasOneOf(meta55, hashable, offset - 1,
611 if (hashable[offset + 1] == 'J')
617 if (hashable[offset + 1] == 'K')
624 if (hashable[offset + 1] == 'L') {
625 if (((offset == (hashable.length - 3)) && hasOneOf(meta56,
626 hashable, offset - 1, 4))
627 || ((hasOneOf(meta57, hashable,
628 (hashable.length - 1) - 1, 2) || hasOneOf(
629 meta58, hashable, hashable.length - 1, 1)) && hasOneOf(
630 meta59, hashable, offset - 1, 4))) {
641 if ((hasOneOf(meta60, hashable, offset - 1, 3) && (((offset + 1) == (hashable.length - 1)) || hasOneOf(
642 meta61, hashable, offset + 2, 2)))
643 || (hashable[offset + 1] == 'M'))
650 if (hashable[offset + 1] == 'N')
661 if (hashable[offset + 1] == 'N') {
666 if (hasOneOf(meta62, hashable, offset + 1, 1))
673 if (hashable[offset + 1] == 'Q')
680 if (!((offset == (hashable.length - 1)) && !has95
681 && hasOneOf(meta63, hashable, offset - 2, 2) && !hasOneOf(
682 meta64, hashable, offset - 4, 2)))
684 if (hashable[offset + 1] == 'R')
690 if (hasOneOf(meta65, hashable, offset - 1, 3)) {
694 if ((offset == 0) && hasOneOf(meta66, hashable, offset, 5)) {
699 if (hasOneOf(meta67, hashable, offset, 2)) {
700 if (hasOneOf(meta68, hashable, offset + 1, 4))
707 if (hasOneOf(meta69, hashable, offset, 3)
708 || hasOneOf(meta70, hashable, offset, 4)) {
713 if (((offset == 0) && hasOneOf(meta71, hashable, offset + 1, 1))
714 || hasOneOf(meta72, hashable, offset + 1, 1)) {
716 if (hasOneOf(meta73, hashable, offset + 1, 1))
722 if (hasOneOf(meta74, hashable, offset, 2)) {
723 if (hashable[offset + 2] == 'H')
724 if (hasOneOf(meta75, hashable, offset + 3, 2)) {
725 if (hasOneOf(meta76, hashable, offset + 3, 2)) {
726 buffer.append("X"); //$NON-NLS-1$
728 buffer.append("SK"); //$NON-NLS-1$
737 if (hasOneOf(meta77, hashable, offset + 2, 1)) {
742 buffer.append("SK"); //$NON-NLS-1$
746 if (!((offset == (hashable.length - 1)) && hasOneOf(meta78,
747 hashable, offset - 2, 2)))
749 if (hasOneOf(meta79, hashable, offset + 1, 1))
755 if (hasOneOf(meta80, hashable, offset, 4)) {
760 if (hasOneOf(meta81, hashable, offset, 3)) {
765 if (hasOneOf(meta82, hashable, offset, 2)
766 || hasOneOf(meta83, hashable, offset, 3)) {
767 if (hasOneOf(meta84, hashable, (offset + 2), 2)
768 || hasOneOf(meta85, hashable, 0, 4)
769 || hasOneOf(meta86, hashable, 0, 3)) {
777 if (hasOneOf(meta87, hashable, offset + 1, 1)) {
784 if (hashable[offset + 1] == 'V')
791 if (hasOneOf(meta88, hashable, offset, 2)) {
797 && (hasVowel(hashable, offset + 1, hashable.length) || hasOneOf(
798 meta89, hashable, offset, 2))) {
801 if (((offset == (hashable.length - 1)) && hasVowel(hashable,
802 offset - 1, hashable.length))
803 || hasOneOf(meta90, hashable, offset - 1, 5)
804 || hasOneOf(meta91, hashable, 0, 3)) {
809 if (hasOneOf(meta92, hashable, offset, 4)) {
810 buffer.append("TS"); //$NON-NLS-1$
817 if (!((offset == (hashable.length - 1)) && (hasOneOf(meta93,
818 hashable, offset - 3, 3) || hasOneOf(meta94, hashable,
820 buffer.append("KS"); //$NON-NLS-1$
821 if (hasOneOf(meta49, hashable, offset + 1, 1))
827 if (hashable[offset + 1] == 'H') {
834 if (hashable[offset + 1] == 'Z')
843 return buffer.toString();
847 * @see org.eclipse.spelling.done.IPhoneticHasher#getMutators()
849 public final char[] getMutators() {
850 return MUTATOR_CHARACTERS;