1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47
| Function NormalisePhrase(ByVal Phrase As String) As String
Dim phrase_normalisee As String
Dim i As Integer
Dim L As Integer
Dim tabPhraseNormalisee() As String
'on remplace les signes de ponctuation par des espaces
phrase_normalisee = Replace(Phrase, ".", "")
phrase_normalisee = Replace(Phrase, ",", "")
phrase_normalisee = Replace(Phrase, ";", "")
phrase_normalisee = Replace(Phrase, ":", "")
phrase_normalisee = Replace(Phrase, "'", "")
phrase_normalisee = Replace(Phrase, "(", "")
phrase_normalisee = Replace(Phrase, ")", "")
phrase_normalisee = Replace(Phrase, "!", "")
phrase_normalisee = Replace(Phrase, "?", "")
phrase_normalisee = Replace(Phrase, "-", "")
'on supprime les espaces au début et à la fin de la phrase
phrase_normalisee = Trim(phrase_normalisee)
L = phrase_normalisee.Length
i = 0
Do
If phrase_normalisee(i) = " " Then
Do
If phrase_normalisee(i + 1) = " " Then
phrase_normalisee = phrase_normalisee.Remove(i, 1)
L = L - 1
End If
Loop Until phrase_normalisee(i + 1) <> " "
End If
i = i + 1
Loop While i < L - 1
Return phrase_normalisee
End Function
Function CompteExtraitMots(ByVal Phrase As String, ByRef Mots() As String) As Integer
'Il faudrait spliter.....
End Function |
Partager