I have an assignment where I have to find the letter frequency in a given text from user with GUI in Java. The problem is that I am Albanian and our alphabet has 36 letters: a,b,c...etc but also 'dh' 'll' 'nj' 'th' 'xh' 'zh' 'ë' 'Ç'..
should I use 'if' to compare the next letter: if I have 'd' and the next one is 'h' I consider it as one letter 'dh' and find its frequency? Is there any other way in Java? What about the two last letters? Does Java recognise them as characters? Thanks.
You will need to use Unicode-aware methods such as
Character.isLetter()
. Here is the code from http://rosettacode.org/wiki/Letter_frequency#JavaHere I modified it to include Unicode characters