pyt8.py 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. #!/usr/bin/env python
  2. # -*- coding: utf-8 -*-
  3. # this programme compare a text in french and its translation in englishe and liste the common words .
  4. with open("JVFR.txt", "r") as textFr:
  5. for line in textFr:
  6. line=line.strip()
  7. mots=line.split()
  8. #for mot in mots :
  9. #print(mot)
  10. with open("JVEN.txt", "r") as textEn:
  11. for line in textEn:
  12. line=line.strip()
  13. words=line.split()
  14. for word in words :
  15. print(word)
  16. nb=0
  17. for word in words:
  18. word = word.strip(" ;''?:,()!.\").”-")
  19. for mot in mots:
  20. #mot = mot.strip(" ;''?:,()!.\").”-")
  21. if word == mot :
  22. nb= nb+1
  23. print(word)
  24. print("nombres des mots anglais identiques =" , nb)
  25. with open("JVES.txt", "r") as textEs:
  26. for line in textEs:
  27. line=line.strip()
  28. palabs=line.split()
  29. #for palab in palabs :
  30. #print(palab)
  31. nbr=0
  32. for palab in palabs:
  33. palab = palab.strip(" ;''?:,()!.\").”-")
  34. for mot in mots:
  35. #mot = mot.strip(" ;''?:,()!.\").”-")
  36. if palab == mot :
  37. nbr= nbr+1
  38. print(word)
  39. print("nombres des mots espagnole identiques =" , nbr)