pyt9.py 796 B

12345678910111213141516171819202122232425262728293031323334
  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. nm =0
  5. with open("JVFR.txt", "r") as textFr:
  6. for line in textFr:
  7. line=line.strip()
  8. mots=line.split()
  9. for mot in mots :
  10. nm=nm+1
  11. print(mot)
  12. print(nm)
  13. nw=0
  14. with open("JVEN.txt", "r") as textEn:
  15. for line in textEn:
  16. line=line.strip()
  17. words=line.split()
  18. for word in words :
  19. nw=nw+1
  20. #print(word)
  21. print(nw)
  22. #for mot in mots :
  23. #print(mot)
  24. nb=0
  25. for word in words:
  26. #print(word)
  27. #word = word.strip(" ;''?:,()!.\").”-")
  28. for mot in mots:
  29. #print(mot)
  30. #mot = mot.strip(" ;''?:,()!.\").”-")
  31. if word == mot :
  32. nb= nb+1
  33. print(word)
  34. print("nombres des mots anglais identiques =" , nb)