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

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 06:30
Exchanging which type of data uses the least bandwidth? music photographs video voice bandwidth- the amount of data that can be moved between two points in a set time period
Answers: 1
question
Computers and Technology, 23.06.2019 17:00
The camera still is bad even with the new iphone xr and especially in low light it is even worst because you can see the pixels more if its in low light. if all you apple customers want apple to fix this then lets fill there feedback with complaints about the
Answers: 1
question
Computers and Technology, 23.06.2019 19:00
This question involves a class named textfile that represents a text file. public class textfile { private string filename; private string filename; private arraylist words; // constructors not shown // postcondition: returns the number of bytes in this file public int filesize() { } // precondition: 0 < = index < words.size() // postcondition: removes numwords words from the words arraylist beginning at // index. public void deletewords(int index, int numwords) { } // precondition: 0 < = index < = words.size() // postcondition: adds elements from newwords array to words arraylist beginning // at index. pub lic voidaddwords(int index, string[] newwords) { } // other methods not shown } complete the filesize() method. the filesize() is computed in bytes. in a text file, each character in each word counts as one byte. in addition, there is a space in between each word in the words arraylist, and each of those spaces also counts as one byte. for example, suppose the words arraylist stores the following words: { mary had a little lamb; its fleece was white as snow. } the filesize() method would compute 4 + 3 + 1 + 6 + 5 + 4 + 6 + 3 + 5 + 2 + 5 as the sum of the lengths of each string in the arraylist. the value returned would be this sum plus 10, because there would also be 10 spaces in between the 11 words. complete the filesize() method below: // postcondition: returns the number of bytes in this file public int filesize() { }
Answers: 1
question
Computers and Technology, 24.06.2019 04:30
1. web and mobile applications allow users to be actively engaged in an online activity. a true b false 2. some examples of business applications purposes are to collaborate, share files, meet virtually in real-time, and accept payments. a true b false 3. an education application would most likely do which of the following? a allow users to watch popular movies and tv shows b connect users with social and business contacts c confirm users' travel plans d teach users a new language 4. a uniform resource locator (url) is how the internet knows where to take users when an address is typed into a browser. a true b false 5. deon is required to provide the citation information for his sources. what type of information should he collect from his sources? a author name, title, date of publication, date of access, url b connections to background information c interesting facts and statistics d notes on important information
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
question
Biology, 05.02.2021 21:40
question
Mathematics, 05.02.2021 21:40
question
Mathematics, 05.02.2021 21:40
Questions on the website: 13722363