Courses‎ > ‎Intro to CS - Full Year‎ > ‎Spring‎ > ‎Dyrland-Weaver‎ > ‎Work‎ > ‎

Work 31: 5/1

posted May 1, 2019, 11:50 AM by JonAlf Dyrland-Weaver   [ updated May 1, 2019, 12:29 PM ]
With your table buddy, make the following modifications to your book analysis program:
  1. Print out the number of unique characters present in the book.
  2. Modify your tallying function to only count the frequencies of alphanumeric characters (only letters and numbers).
  3. Create a function that takes the frequency dictionary as an argument and a number, N. It should return a dictionary where the keys are the top N characters in the book and the values are their respective frequencies.
  4. Sample output:
    1. chacracter analysis of wonderland.txt
      unique characters: 54
      mode: e count: 13388
      top 5 characters: {'e': 13388, 'a': 8153, 'o': 7969, 't': 10217}
  5. Optional modifications
    1. Do not count upper and lower case letters separately
    2. Modify the frequency dictionary function so you can specify characters to allow (or ignore)
    3. Perform other statistical analyses.
  6. Don't like Alice's Adventures in Wonderland?
    1. Go to: https://www.gutenberg.org/catalog/
    2. iInd a book and download the "Plain Text UTF-8" version.
      1. Note there is a lot of extra stuff at the top and bottom of these files, you should cut that out when performing your analysis.
submit this as book_0
Comments