Column word count

I’m trying get a total word count for a column, which sounds very easy, but I can’t find the appropriate KNIME nodes to carry this out. My data looks like the following:

TITLE
engineer
academic researcher
intern
data scientist

I’m looking for a node that will count all individual words in such a column and return 6 for the above example. I have already de-duped the column so just a word count will suffice.

Thank you.

Hi there!

What you can do is to use String Manipulation node and count number of spaces which appear in cell. Then use Math Formula node to add 1. Then sum it with Group by node.

Maybe there is a better way of course :slight_smile:

Br,
Ivan

You can use:
1 - input data: column1
2 - java snippet node (count words in rows): column2 = column1.split("\s+").length;
column1 - string
column2 - integer
3 - group by node (sum counted words): manual aggregation (column2: sum).

Please check the results.

— Robert

1 Like