supa
03-27-2001, 03:54 AM
How to count the number of occurances of all the words in a text file using
java?
java?
|
Click to See Complete Forum and Search --> : help supa 03-27-2001, 03:54 AM How to count the number of occurances of all the words in a text file using java? Simon Sellick simon.sellick 03-27-2001, 09:47 AM "supa" <supa_alwayscool@mailcity.com> wrote: > >How to count the number of occurances of all the words in a text file using >java? You could try: Decide what characters delimit a word and use strtok() on an input stream connected to the file to retrieve each word in turn. For each word, determine whether it is already present in an indexed list of word counts: if so, increment the count, otherwise add it and set the count to 1. I'll leave you to find a suitable class for holding the indexed set of word counts - there is a class perfectly suited. Good luck. devx.com
Copyright Internet.com Inc. All Rights Reserved |