subject

You will write a program to solve the co-occurrence problem. The co-occurrence problem is stat- ed as follows. We have a file containing English sentences, one sentence per line. Given a list of query words, your program should output the line number of lines that have all those words. Show your pointer prowess in completing this assignment.
Assume the text in file contains only lowercase letters, does not have these punctuation charac- ters ( ; " ‘ - ) and no digits. Ignore all other punctuation characters while processing the lile
Here is one example. Assume that the following ih ct cluded for clarity; the actual file doesn't have line numbers of the file. Line numbers are in
1. try not to become a man of success, but rather try to become a man of value.
2. look deep into nature, and then you will understand everything better.
3. the true sign of intelligence is not knowledge but imagination.
4. we cannot solve our problems with the same thinking we used when we created them.
5. weakness of attitude becomes weakness of character.
6. you can not blame gravity for falling in love.
7. the difference between stupidity and genius is that genius has its limits.
(These are quotes from Albert Einstein.)
If we are asked to find al the lines that contain this set of words: "knowledge", imagination", "true") the answer will be line 3 because all three words appeared in line 3. If they appear in more than one line, your program should report all of them. For example, co-oc- currence of "the", "is", will be lines 3 and 7.
Sample Output
Test 1
Enter a file name: einstein. txt
Enter space-separated words: the The co-occurance for word: the Lines: 3, 4, 7
Enter space-separated words: the is The co-occurance for words: the, is Lines: 3, 7
Enter space-separated words: true knowledge imagination
The co-occurance for: true, knowledge, imagination Lines: 3
Enter space-separated words: q

ansver
Answers: 1

Other questions on the subject: Computers and Technology

image
Computers and Technology, 21.06.2019 16:40, kaileyy06
Match each feature of e-publishing as an advantage, a disadvantage, a threat, or an opportunity. (choices) increased collaboration digitalized out-of-print versions monopoly over digital formats requirement for a specialized digital device pairs advantage of e-publishing disadvantage of e- opportunity for e- threat to e-
Answers: 1
image
Computers and Technology, 22.06.2019 03:00, nsjcbdhcb
Data is processed, stored, and transmitted as a series of 1s and 0s. each 1 or 0 is called a(n) . a series of eight 0s and 1s, called a(n) , represents one character—a letter, number, or punctuation mark. data becomes when it is presented in a format that people can understand and use. digital signals are represented by two different , such as +5 volts and +.2 volts. digital data can also take the form of light and dark spots etched onto the surface of a cd or the positive and negative orientation of particles on the surface of a hard disk. data consists of numbers that might be used in arithmetic operations. it can be represented digitally using the number system. data is composed of letters, symbols, and numerals that are not used in arithmetic operations. computers represent this type of data using , ebcdic, unicode, or utf-8. data is quantified using terms such as or kibibyte (1024 bytes), and prefixes such as or mebi (1,048,576), and giga or (1,073,741,824). to reduce file size and transmission times, digital data can be compressed. compression provides the means to compress data and reconstitute it into its original state. compression throws away some of the original data during the compression process. compressed files usually have at the end of the file name and are represented with special icons. these files have to be or unzipped before you can view the data they contain.
Answers: 1
image
Computers and Technology, 22.06.2019 18:30, leannhb3162
Which of these options are the correct sequence of actions for content to be copied and pasted? select content, click the copy button, click the paste button, and move the insertion point to where the content needs to be inserted. click the copy button, select the content, move the insertion point to where the content needs to be inserted, and click the paste button. select the content, click the copy button, move the insertion point to where the content needs to be inserted, and click the paste button. select the content, move the insertion point to where the content needs to be inserted, click the copy button, and click the paste button.
Answers: 3
image
Computers and Technology, 23.06.2019 12:30, legend101xD
Animations and transitions are added from the
Answers: 1
You know the right answer?
You will write a program to solve the co-occurrence problem. The co-occurrence problem is stat- ed a...

Questions in other subjects:

Konu
Mathematics, 05.02.2020 10:43
Konu
Health, 05.02.2020 10:43