-2

it's my first time programming ever and we have this assignment on finding both word frequencies and word pair frequencies in a text file I've followed several tutorials online and implemented a rather fast word count solution however i have no clue on how to implement a method on ho to get all the word pairs in the text file and sum up the frequencies of duplicate word pairs to find their frequencies before adding them to an array (hashmap) i tried asking my instructor but he is adamant on us figuring it out ourselves , please just point me in the right direction to a paper / article / tutorial (anything)i can read in-order to solve this

thanks in advance

  • Do not think about the code, think about a possible algorithm. Do you have any idea? – dcolazin May 18 '22 at 20:23
  • Welcome to stackoverflow. This is not a free code-writing or "google me a tutorial" service. We can help with specific questions about your code, but we don't write it for you. See [ask]. – Robert May 18 '22 at 21:48
  • Please clarify your specific problem or provide additional details to highlight exactly what you need. As it's currently written, it's hard to tell exactly what you're asking. – Sumit Sharma May 19 '22 at 04:21

1 Answers1

0

Ideally this would be done using a hash map with String and Integer values. You can check wether it is in the hash map before adding it as a new value and frequency to the map.

Here is an example of a previously answered question using this method. Counting frequency of words from a .txt file in java

  • Your answer could be improved with additional supporting information. Please [edit] to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Sumit Sharma May 19 '22 at 03:58