首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Soundex错误:找不到符号

Soundex错误:找不到符号
EN

Stack Overflow用户
提问于 2015-12-08 22:39:34
回答 1查看 62关注 0票数 0

获取以下错误:

错误:找不到符号so = Soundex.parse(s,true);

代码语言:javascript
复制
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,方法如下:

代码语言:javascript
复制
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);
}
EN

回答 1

Stack Overflow用户

发布于 2015-12-08 22:52:33

我看得出你在用两种方法,

代码语言:javascript
复制
 so = Soundex.parse(s);
so = Soundex.parse(s, true);

但根据方法定义,只有

代码语言:javascript
复制
static String parse(String s, boolean uppercase) 

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

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/34167435

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档