diff --git a/source/ch3_javadatatypes.ptx b/source/ch3_javadatatypes.ptx index 199b13b..d7187f6 100644 --- a/source/ch3_javadatatypes.ptx +++ b/source/ch3_javadatatypes.ptx @@ -826,11 +826,11 @@ public class HistoArray {

- Lets stay with a simple frequency counting example, only this time we will count the frequency of words in a document. A simple Python program for this job could look like this: + Lets stay with a simple frequency counting example, only this time we will count the frequency of words in a document. shows a simple Python program for what this could look.

- - + + def main(): data = open('alice30.txt') @@ -845,11 +845,14 @@ def main(): main() +

- This program reads the file alice30.txt (which follows), and it then splits it into a list of words. Next it creates a dictionary called count which maps each word to the number of times that word occurs in the text. Finally, it prints out the words in alphabetical order along with their frequency. + This program reads the file alice30.txt in , and it then splits it into a list of words. Next it creates a dictionary called count which maps each word to the number of times that word occurs in the text. Finally, it prints out the words in alphabetical order along with their frequency.

+ + Data file for testing the word frequency program
 
             Down, down, down. Would the fall NEVER
@@ -872,12 +875,13 @@ main()
             nice grand words to say.)
             
+

- Notice that the structure of the program is very similar to the numeric histogram program. + Notice that the structure of is very similar to the numeric histogram program.

- - + + import java.util.Scanner; import java.util.ArrayList; @@ -915,9 +919,10 @@ public class HistoMap { } +

- Improve the program above to remove the punctuation. + Improve to remove the punctuation.