i***0 发帖数: 8469 | 1 QUESTIONS
1. Given an arbitrary text document written in English, write a program
that will generate a concordance, i.e. an alphabetical list of all word
occurrences, labeled with word frequencies. Bonus: label each word with the
sentence numbers in which each occurrence appeared.
a. a {2:1,1}
b. all {1:1}
c. alphabetical {1:1}
d. an {2:1,1}
e. appeared {1:2}
f. arbitrary {1:1}
g. bonus {1:2}
h. concordance {1:1}
i. document | G***l 发帖数: 355 | 2 这还不简单。
用一个hashtable存储,key是单词,values是arraylist,这个arraylist的第一个位置
存放次数,后面依次存放出现的句子数。
顺序读取文件,一个个句子一个个词的扫描。每扫描到一个词,加入到hashtable里或
者改变对于的value里面的值。
要是在java里,可以用treemap代替hashtable来存储,因为treemap的key是排序的。
the
【在 i***0 的大作中提到】 : QUESTIONS : 1. Given an arbitrary text document written in English, write a program : that will generate a concordance, i.e. an alphabetical list of all word : occurrences, labeled with word frequencies. Bonus: label each word with the : sentence numbers in which each occurrence appeared. : a. a {2:1,1} : b. all {1:1} : c. alphabetical {1:1} : d. an {2:1,1} : e. appeared {1:2}
|
|