Sub CountWords(Text As String)
Dim words() As String = Regex.Split($"[\s,.()!?"\-:/\\;]+"$, Text)
Dim wordsLength As Map
wordsLength.Initialize
For Each word In words
Dim count As Int
'line 21' word = word.ToLowerCase
If wordsLength.ContainsKey(word) Then
count = wordsLength.Get(word)
count = count + 1
Else
count = 1
End If
wordsLength.Put(word, count)
Next
Dim list1 As List
list1.Initialize
For Each word In wordsLength.Keys
Dim wc As WordCount
wc.Initialize
wc.Word = word
wc.Count = wordsLength.Get(word)
list1.Add(wc)
Next
list1.SortTypeCaseInsensitive("Word", True)
For Each wc As WordCount In list1
Log($"${wc.Word}: ${wc.Count}"$)
Next
End Sub