Advertisement
Guest User

Untitled

a guest
Jun 26th, 2017
58
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.58 KB | None | 0 0
  1. num_words = 0
  2. num_diffs = 0
  3.  
  4. for line in text:
  5. new_line = line.split()
  6. for word in new_line:
  7. word = clean_up(word)
  8. num_words += 1
  9. num_copy = 0
  10. for other_line in text:
  11. other_new_line = other_line.split()
  12. for other_word in other_new_line:
  13. other_word = clean_up(other_word)
  14. if other_word == word:
  15. num_copy += 1
  16. if num_copy < 2:
  17. num_diffs += 1
  18. print num_diffs * 1.0 / num_words
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement