Project

tf_idf

0.01
No commit activity in last 3 years
No release in over 3 years
A TF-IDF in ruby - http://en.wikipedia.org/wiki/Tf–idf
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
 Dependencies

Development

>= 1.2.9
 Project Readme

Tf-Idf¶ ↑

en.wikipedia.org/wiki/Tf–idf

Install¶ ↑

gem sources -a http://gemcutter.org
sudo gem install tf_idf

How To Use¶ ↑

require 'rubygems'
require 'tf_idf'

data = [%w{a a a a a a a a b b}, %w{a a}]

a = TfIdf.new(data)

# To find the term frequencies
a.tf
  #=> [{'b' => 0.2, 'a' => etc...}, {'a' => 1}]

# To find the inverse document frequency
a.idf
  #=> {'b' => 0.301... etc...}

# And to find the tf-idf
a.tf_idf
  #=> [{'b' => 0.0602, 'a' => etc...}, {etc...}]

Copyright © 2009 Red Davis. See LICENSE for details.