differance~20171216-163401.py 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. #!/usr/bin/env python
  2. # -*- coding: utf-8 -*-
  3. # Copyright (C) 2017 Constant, Algolit
  4. # This program is free software: you can redistribute it and/or modify
  5. # it under the terms of the GNU General Public License as published by
  6. # the Free Software Foundation, either version 3 of the License, or
  7. # (at your option) any later version.
  8. # This program is distributed in the hope that it will be useful,
  9. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  11. # GNU General Public License for more details: <http://www.gnu.org/licenses/>.
  12. '''
  13. Input texts are checked against a dictionary that assigns weights to different vowels.
  14. The script gives a score for a specific sentence.
  15. '''
  16. # create a dictionary
  17. scrabble = {'au': 'o', 'ie': 'y', 'eau': 'o', 'ai': 'e'}
  18. # find a sentence / string
  19. sentence = "J'ai la vie qui est un beau mystère qu'il faut vivre, et non un problème à résoudre."
  20. # split sentence in list of words
  21. words = sentence.split()
  22. # for each word
  23. for word in words:
  24. # iterate over dictionary
  25. for k,v in scrabble:
  26. print("k", scrabble[k])
  27. print("v", v)
  28. # word = word.replace(k, v)
  29. # print(word)