Java - Count words in two documents

Posted by user552961 on Stack Overflow See other posts from Stack Overflow or by user552961
Published on 2010-12-24T03:34:18Z Indexed on 2010/12/24 3:54 UTC
Read the original article Hit count: 141

Filed under:
|

Good Morning - it is school assignment, I am not asking for any source code (if you can provide any pesudo code it would be awesome).

Here is the problem :( I have to create a term frequency table. It is not pure TF, I just need to count the words and write down.

I know basic steps to do it 1 - extract all terms (I can do it with file reader) 2 - remove repeating terms (I can do it with TreeMap) The output of 2nd step would be

Niga, ponga, dinga, bitlo, etc.

3 - Now I have to see if there is any word in current file from above terms or not, if yes then I will count.

Now this is my problem, I stucked on step 3 :(

I have some idea how to count words with TreeMap (treemap.containskey etc.) but it would be global count not local count for each file :(

Any pseudo code?

© Stack Overflow or respective owner

Related posts about java

Related posts about data-structures