0

I have a few hundred words in arrays in a plist, somewhat like below:

PLIST:
Array 1:
  - words here
  -
  -
  -

Array 2:
  -
  -
  -
  -
  -

etc...

Now I need to have a number associated with every word which increments so that I can then fetch the top 10 most failed words (top ten with highest count). This what I can't get my head around, how to keep a number associated with a word and then get the top ten most incorrect words.

I'd like to figure out a better method; I have my list of words, perhaps a number is needed, but I need to keep a record of the most common errors (I have a method which is called when an error is made, I just need to know how to store the error so I can retrieve the ten most incorrect words later).

4

1 回答 1

0

将单词存储在字典中。单词将是键,对象(值)是该单词出错的次数。然后,您可以枚举所有单词并通过访问该单词的字典值来访问该单词错误的次数。

于 2012-06-25T22:23:00.827 回答