##############################################################################
#                          Distance de Levenshtein                           #
##############################################################################

import time as t
import numpy as np

## Question 1

def D_Lev_Naif(mot1,mot2) :
    if min(len(mot1),len(mot2)) == 0 :
        return max(len(mot1),len(mot2))
    elif mot1[0] == mot2[0] :
        return D_Lev_Naif(mot1[1:], mot2[1:])
    else :
        D = 1 + min(D_Lev_Naif(mot1[1:],mot2[1:]),D_Lev_Naif(mot1,mot2[1:]),D_Lev_Naif(mot1[1:],mot2))
        return D

## Question 2

def test_naif():
    print("La distance de Levenshtein entre 'informatif' et 'informatisations'")
    t1=t.time()
    print(' est de :',D_Lev_Naif('informatif','informatisations'))
    t2=t.time()
    print('Cette résolution a pris :',t2-t1,'secondes')
    print("La distance de Levenshtein entre 'informatise' et 'désinforme'")
    t1=t.time()
    print(' est de :',D_Lev_Naif('informatise','désinforme'))
    t2=t.time()
    print('Cette résolution a pris :',t2-t1,'secondes')


## Question 3

# def liste_portions(mot):




## Question 4

# def init_dico(mot1,mot2):







## Question 5

# def dico_distances(mot1,mot2):












## Question 6

# def D_Lev_Memoisation(mot1,mot2):




## Question 7

# def D_Lev_Tableau(mot1,mot2) :

