wc

wc is a rubygem to count word occurrences in a given text.

NEWS This is a major rewrite since version 0.98.2 and the API is completely rewritten from scratch. The expected behavior is to let wc gem to extend a plain ruby String object and use it to retrieve tag cloud. Please note that reading words from a file will be removed in further releases.

Usage

Using wc is easy. Just require the gem and use the to_tag_cloud method to the string containing the text you want to transform in a tag cloud

require 'wc'

"A text longer is here".to_tag_cloud ~> "<ul id=\"cloud\"><li><a href=\"#\" class=\"tag0\">text</a></li><li><a href=\"#\" class=\"tag0\">longer</a></li><li><a href=\"#\" class=\"tag0\">here</a></li></ul>"

Note on Patches/Pull Requests

  • Fork the project.

  • Make your feature addition or bug fix.

  • Add tests for it. This is important so I don’t break it in a future version unintentionally.

  • Commit, do not mess with rakefile, version, or history. (if you want to have your own version, that is fine but bump version in a commit by itself I can ignore when I pull)

  • Send me a pull request. Bonus points for topic branches.

Copyright © 2011 Paolo Perego. See LICENSE for details.