获取以下错误:
错误:找不到符号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);
}发布于 2015-12-08 22:52:33
我看得出你在用两种方法,
so = Soundex.parse(s);
so = Soundex.parse(s, true);但根据方法定义,只有
static String parse(String s, boolean uppercase) 方法签名是存在的。请检查第一种方法是否存在一种争论。
https://stackoverflow.com/questions/34167435
复制相似问题