Hello,
I'm scanning a
word file and creating
Word objects out of each word in the file. I added a delimiter to my scanner because the 'rules' for what is considered to be a word are different. I got it to work and I have an arraylist of Word objects.
My problem has to do with what I need to do next. I need to rescan the file, and whenever I encounter one of the words from my list of words in the text file, I need to store the line number and paragraph number(occurance of the word) in the word object. I have a method to do that.
To be more particular, I can't figure out how to set up my counts to count the line number and paragraph number. Both are meant to start at 1, but the line number needs to reset back to 1 each time I get to a new paragraph. Paragraphs are separated by one or more blank lines. Also, the text file is UNIX-format.
Here is my code which first scans in all the words and adds them to the list, then removes the duplicates:
Here is my flawed code: (where i try to add the paragraph-line pairs to each word)
Any help with this would be greatly appreciated!
Thank you!