#!/usr/bin/python # -*- coding: utf-8 -*- import csv mots = [] def main(): with open("Lexique382.txt") as lexique: lexique = csv.reader(lexique, delimiter='\t') for raw in lexique: if raw[3] == "NOM": mots.append(Nom(raw[0], raw[4], raw[5])) print(mots[10].nombre) class Nom(): """docstring for Nom.""" def __init__(self, mot, genre, nombre): self.mot = mot self.genre = genre self.nombre = nombre def determinant(self): if self.nombre == 'p': return "les " elif self.mot[0] in ['a','à','e','é','è','ê','i','o','u','y']: return "l'" elif self.genre == 'f': return "la " else return "le " def preposition(self): if self.determinant() == "les ": return "aux " if self.determinant() == "le ": return "au " if self.determinant() == "la ": return "à la " if self.determinant() == "l'": return "à l'" main()