Emily Dickinson Experiment

Lets read some poety, and see what we can do...

https://repl.it/@JimSkon/EmilyDickinson

1. What if we search for "see"? How about "see;"? How about "say", "say,', "Say", and "Say,"? what chould we do about that

2. Use the code from #1 to count the "was", and "was,". Why is there a difference? Consider the code below:


def removePunctuation(s):
  import string
  for c in string.punctuation:
    s= s.replace(c,"")
  return s

What does this do? Call this on every line and search for "was" now?

3. Consider the function s.lower(), where s is a string. What does it do? How might this be useful in the find repeated word code?

4. Can you make the program count the number of occurences of a word?

5. Can you find and display all the lines that have a repeated word? Can you include the word, and the number of occurances in the line for ech repeated word?

6. What would it take to create a list of all words, and the number of occurances?

7. Could we count the number of times each vowel is used?

Solutions

Edit | Attach | Watch | Print version | History: r5 < r4 < r3 < r2 < r1 | Backlinks | Raw View | Raw edit | More topic actions...
Topic revision: r3 - 2018-10-02 - JimSkon
 
  • Edit
  • Attach
This site is powered by the TWiki collaboration platform Powered by PerlCopyright © 2008-2019 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback