By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
432,002 Members | 2,157 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 432,002 IT Pros & Developers. It's quick & easy.

Project help count total number of words " Data Structure "

P: 1
Hi
I need help please
This is my project and i need a help to solve it with you

A page of text is to be read and analyzed to determine number of occurrences and locations of different words. The results of the analysis are to be stored in a suitable data structure. The main task in this project is to design a suitable ADT (call it WAnalysis) to store the results and enable the following operations to be performed as fast as possible:
(i) An operation to determine the total number of words of a particular length occurring in the page.
(ii) An operation to determine the total number of occurrences of a particular word.
(iii) An operation to display the locations of the occurrences of a word starting from the top of the page as a list of line and word numbers. Note that every new-line character indicates end of a line.

Phase I
In the first phase of the project you will describe the design of the ADT you suggest for the problem, as follows:
(a) Give the graphical representation of the ADT to show its structure. Label the diagram clearly.
(b) Give a specification of the operations (i), (ii) and (iii), and other supporting operations you may need to read the text from a text file and store the results in the ADT (e.g. insert).

Phase II
In the second phase of the project you will implement the ADT and the operations you specified in the first phase as a single Java class WAnalysis. You may use the ADTs you have studied in the course.
You must also give the time complexity of the algorithms you used to implement the above operations.

Example Input and Output Data:
Assume that words are separated by at least one space. Single letter words e.g. ‘a’, ‘I’, are counted as words. Punctuation (e.g. commas, periods, etc.) is to be ignored. Hyphenated words (e.g. ‘decision-makers’) or apostrophized words (e.g. ‘customer’s’) are to be read as single words. See the following example of a piece of text in the font Times New Roman, and size 12pts:

In these ways, the testing methodology provides a window into the total Web Experience from the customer’s point of view, providing insight and direction for business decision- makers. Marketing executives discover how they should allocate resources for maximal impact, while designers obtain insight into why particular features and functions are not working as planned and how to best modify them.

The output of the operation (i) for word length 3 would be 14.
The output of the operation (ii) for the word ‘and’ would be 3.
The output of the operation (iii) for the word ‘and’ would be (2, 9) (4, 10) (5, 4). Note that (2, 9) indicates that word ‘and’ is occurring on line 2 as the ninth word.

Thank you
Nov 8 '09 #1
Share this Question
Share on Google+
2 Replies


Dököll
Expert 100+
P: 2,364
Hey there!

If you could post a bit of your code, it would be great. Might get better hits on your question that way...

In a bit!
Nov 9 '09 #2

Frinavale
Expert Mod 5K+
P: 9,731
Please take the time to research the problem before you post your question. The experts here are more than willing to help you with a specific problem but you have to do your part to learn the basics and also formulate a specific question we can help with. Please take the time to read over the Posting Guidelines, specifically the section on Before you Post your Question.

Before posting any question you are expected to attempt to find and work on a solution. When you find a specific problem with your attempt, that is the time to post here requesting assistance with any difficulties you have or about a particular function of the code that you don't know how to achieve. When posting your problem, details of the problem itself and where it's found are the bare minimum information required. The experts on this site are more than happy to help you with your problems but they cannot do your assignment/program for you.

Code may be posted for reference purposes, but please don't expect us to work out the meaning of your problem by reverse-engineering your code. The question you post must make sense in its own right.
Nov 9 '09 #3

Post your reply

Sign in to post your reply or Sign up for a free account.