guess_month méthode de classe

This commit is contained in:
Jean-Marie Favreau 2024-10-12 17:55:01 +02:00
parent 654314a61b
commit de4b54baa4

View File

@ -27,7 +27,7 @@ class Extractor(ABC):
else:
return start_day
def guess_month(self, text):
def guess_month(text):
mths = [
"jan",
"fe",
@ -55,14 +55,14 @@ class Extractor(ABC):
)
if m:
day = m.group(1)
month = self.guess_month(m.group(2))
month = Extractor.guess_month(m.group(2))
year = m.group(3)
else:
# format Numero Mois Annee
m = re.search("([0-9]+)[er]*[ ]*([a-zA-ZéÉûÛ:.]+)[ ]*([0-9]+)", text)
if m:
day = m.group(1)
month = self.guess_month(m.group(2))
month = Extractor.guess_month(m.group(2))
year = m.group(3)
else:
# format Numero Mois Annee