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