Получение следующее сообщение об ошибке:Ошибка с Soundex: не может найти символ
error: cannot find symbol so = Soundex.parse(s, true);
public static List<String> getSimilar(String s)
{
List<String> simWords = new LinkedList<>();
// Find uppercase and lowercase Soundex ID for letters
String so;
if (Character.isLetter(s.charAt(0))) {
so = Soundex.parse(s, true);
if (dictionary.containsKey(so)) simWords.addAll(dictionary.get(so));
so = Soundex.parse(s, false);
if (dictionary.containsKey(so)) simWords.addAll(dictionary.get(so));
}
else {
so = Soundex.parse(s);
if (dictionary.containsKey(so)) simWords.addAll(dictionary.get(so));
}
return simWords;
}
у меня есть в той же папке, что этот файл и в пределах Soundex.java
, что класс называется Soundex
и метод ниже:
static String parse(String s, boolean uppercase) {
Soundex sx = new Soundex(s);
if (uppercase) {
sx.code[0] = Character.toUpperCase(sx.code[0]);
} else {
sx.code[0] = Character.toLowerCase(sx.code[0]);
}
return new String(sx.code);
}
Похоже, что компилятор жалуется на Soundex.parse (s, true); Но тогда я не уверен, что это сообщение компилятора или его перефразирование. Однако я замечаю несколько строк, которые вы вызываете parse() только с одним параметром. –