Search this blog

Saturday 26 November 2011

Counting words in a document: a better way

A much easier way to count words in a document compared to this previous post is to use the word list that is generated by text processing operators.

This example shows this. It uses the "Wordlist to Data" operator and then does some light gymnastics to calculate the sum and count of words to produce the desired results.

2 comments:

  1. for a collection of documents( for eg: a.csv or .xls file), what modification has to be done for counting words in each of these documents?

    Thanks in advance

    Dev

    ReplyDelete
  2. You would need to loop for all files. Inside this loop you would read the file as a document and then pass to the word counting process. I'll make a new post with an example.

    ReplyDelete