Files
ola5doc/output/sources/pyt9b.py
T

49 lines
1.4 KiB
Python
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# this programme compare a text in french and its translation in englishe and liste the common words .import codecs
import codecs
f = codecs.open("JVFR.txt", encoding='utf-8') # on précise lencodage à louverture
textFr = f.read() # txt est une unicode
nm =0
#with open("JVFR.txt", encoding='utf-8', "r") as textFr:
for line in textFr:
line=line.strip()
mots=line.split()
for mot in mots :
#mot=mot.strip(" ;''?:,()!.\").”-")
nm=nm+1
#print(mot)
print("nombres de mots en text francais = ", nm)
#
E = codecs.open("JVEN.txt", encoding='utf-8') # on précise lencodage à louverture
textEN = E.read() # txt est une unicode
nb =0
#with open("JVFR.txt", encoding='utf-8', "r") as textFr:
for line in textEN:
line=line.strip()
words=line.split()
for word in words :
#mot=mot.strip(" ;''?:,()!.\").”-")
nb=nb+1
#print(mot)
print("nombres de mots en text anglais = ", nb)
S = codecs.open("JVES.txt", encoding='utf-8') # on précise lencodage à louverture
textES = S.read() # txt est une unicode
nmb =0
#with open("JVFR.txt", encoding='utf-8', "r") as textFr:
for line in textES:
line=line.strip()
parabls=line.split()
for parabl in parabls:
#mot=mot.strip(" ;''?:,()!.\").”-")
nmb=nmb+1
#print(mot)
print("nombres de mots en text espagnol = ", nmb)