texte-a-trous~20171216-171010.py 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. #!/usr/bin/python
  2. # -*- coding: utf-8 -*-
  3. import csv
  4. mots = []
  5. def main():
  6. with open("Lexique382.txt") as lexique:
  7. lexique = csv.reader(lexique, delimiter='\t')
  8. for raw in lexique:
  9. if raw[3] == "NOM":
  10. mots.append(Nom(raw[0], raw[4], raw[5]))
  11. print(mots[10].nombre)
  12. class Nom():
  13. """docstring for Nom."""
  14. def __init__(self, mot, genre, nombre):
  15. self.mot = mot
  16. self.genre = genre
  17. self.nombre = nombre
  18. def determinant(self):
  19. if self.nombre == 'p':
  20. return "les "
  21. elif self.mot[0] in ['a','à','e','é','è','ê','i','o','u','y']:
  22. return "l'"
  23. elif self.genre == 'f':
  24. return "la "
  25. else
  26. return "le "
  27. def preposition(self):
  28. if self.determinant() == "les ":
  29. return "aux "
  30. if self.determinant() == "le ":
  31. return "au "
  32. if self.determinant() == "la ":
  33. return "à la "
  34. if self.determinant() == "l'":
  35. return "à l'"
  36. main()