algorithm - Tracking/Counting Word Frequency -


I want to get some community consent on a good design so that the word is able to calculate and store frequency. I am creating an application in which I have to parse and store the text input, how often the word will appear (over time).

  • The following values:

     
  • Code> word counting ------------- kill 1 a 2 brain 2 bird 1 piano 1 player 1

    and later a given arbitrary word Be able to quickly query for the count value of

    My current plan is to store words and count in only one database, and the word count values ​​depend on caching. But I suspect that I have enough cash to make this long enough viable solution long Hit will not get.

    Can anyone suggest algorithms, or data structures, or can it solve a well by any other idea?

  • I do not understand why you think the database will not be a suitable solution, you may have approximately 100000 lines And the small size of the table will mean that it can be stored in memory completely, make the word the primary key and the look will be very fast.


    Comments