From the course: Developing Unicode-Aware Applications in Go

Unlock this course with a free trial

Join today to access over 24,900 courses taught by industry experts.

Solution: Word frequency

Solution: Word frequency

(upbeat music) - [Instructor] Let's have a look at my solution. So I'm going to use regular expressions and I'm using MustCompile and I'm saying that the word is, and this is a Unicode character class, a letter, one or more. And now I'm defining the frequencies, which is a map from string, the word to and how many times it appears in the text. I'm using FindAllString in the text with minus one telling it give me everything. And I'm just updating the frequency of the word with plus plus. And finally returning the frequencies. And now we can go to the test and run it and it's going to pass.

Contents