CPSC270A
Software Eng & Project Design

Activity 4

Word Count with Dart

Write a dart progam that creates a histogram of a text file’s word counts.

Details

The program should:

  1. read the text of a file into a string.

  2. create a list of words in the file. Assume that words are any text that is separated by whitespace.

  3. create a map between every word and the number of times it occurs in the file.

  4. print the map.

The program should not use any loops. Instead, use iterable methods.

Example

If the a text file contains:

this is some text
it is not interesting text
yet text it is

The program would print something like:

{this: 1, is: 3, some: 1, text: 3, it: 2, not: 1, interesting: 1, yet: 1}