-
help
How to count the number of occurances of all the words in a text file using
java?
-
Re: help
"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.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
Forum Rules
|
Top DevX Stories
Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL
|
Bookmarks