0

Getting the following error:

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;
}

I've got a Soundex.java in the same folder as this file and within that the class is named Soundex and the method is below:

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);
}
Sergii Zhevzhyk
  • 4,074
  • 22
  • 28
Tii
  • 1
  • It looks like the compiler is complaining about Soundex.parse(s, true); But then I'm not positive that's a compiler message or your paraphrasing of it. However I do notice a few lines down that you're calling parse() with just one parameter. – Steve Cohen Dec 08 '15 at 22:51

1 Answers1

0

I can see you are calling two methods,

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

but according to method defintion,only

static String parse(String s, boolean uppercase) 

mthod signature exist. Please check if first method with one arguement exist.

Naruto
  • 4,221
  • 1
  • 21
  • 32
  • yes there is a method which accepts one argument. static String parse(String s) { return new String(new Soundex(s).code); } – Tii Dec 08 '15 at 23:39