importer tout le dossier corpus
This commit is contained in:
10
markov.py
10
markov.py
@@ -1,11 +1,11 @@
|
|||||||
from collections import defaultdict
|
from collections import defaultdict
|
||||||
from random import choice, randrange
|
from pathlib import Path
|
||||||
|
from random import choice
|
||||||
|
|
||||||
|
|
||||||
suivants = defaultdict(list)
|
suivants = defaultdict(list)
|
||||||
for path in (
|
for chemin in Path("corpus").iterdir():
|
||||||
"fra_wikipedia_2021_10K-sentences.txt",
|
with open(chemin, "r", encoding="utf-8") as fichier:
|
||||||
):
|
|
||||||
with open(path, "r", encoding="utf-8") as fichier:
|
|
||||||
for phrase in fichier:
|
for phrase in fichier:
|
||||||
antepenultieme, penultieme = "", ""
|
antepenultieme, penultieme = "", ""
|
||||||
for word in phrase.split():
|
for word in phrase.split():
|
||||||
|
|||||||
Reference in New Issue
Block a user