Advertisement
DeaD_EyE

If you seek for pattern, you'll find patterns.

Mar 20th, 2020
349
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.70 KB | None | 0 0
  1. """
  2. Quelle Wörterbuch: https://sebastian-software.de/blog/2015-07/rechtschreibung-und-jekyll/
  3. """
  4.  
  5. from string import ascii_uppercase
  6. from pathlib import Path
  7.  
  8.  
  9. def get_sum(dictionary):
  10.     table = " " + ascii_uppercase
  11.     with dictionary.open() as fd:
  12.         for line in fd:
  13.             word, _, type = line.partition("/")
  14.             word = word.upper()
  15.             if len(word) == 6 and all(c in ascii_uppercase for c in word):
  16.                 word_sum = sum(map(table.index, word))
  17.                 if word_sum == 66:
  18.                     yield word
  19.  
  20.  
  21. dictionary = Path.home() / "Desktop/de-DE.dic"
  22. words = '\n'.join(sorted(set(get_sum(dictionary))))
  23. print(words)
  24. print(len(words))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement