Soundex出错:无法找到符号

时间:2015-12-08 22:39:34

标签: java soundex

收到以下错误:

  

错误:找不到符号所以= S oundex.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);
}

1 个答案:

答案 0 :(得分:0)

我可以看到你正在调用两种方法,

 so = Soundex.parse(s);
so = Soundex.parse(s, true);

但根据方法定义,只有

static String parse(String s, boolean uppercase) 

存在mthod签名。请检查是否存在具有一个争论的第一种方法。

相关问题