| 1 | = bayon/Ruby |
|---|
| 2 | |
|---|
| 3 | Copyright (c) 2009 SUGAWARA Genki <sgwr_dts@yahoo.co.jp> |
|---|
| 4 | |
|---|
| 5 | == Description |
|---|
| 6 | |
|---|
| 7 | Ruby bindings for bayon. |
|---|
| 8 | |
|---|
| 9 | see {bayon}[http://code.google.com/p/bayon/]. |
|---|
| 10 | |
|---|
| 11 | == Install |
|---|
| 12 | |
|---|
| 13 | gem install bayon |
|---|
| 14 | |
|---|
| 15 | == Example |
|---|
| 16 | |
|---|
| 17 | require 'bayon' |
|---|
| 18 | |
|---|
| 19 | docs = Bayon::Documents.new |
|---|
| 20 | docs.cluster_size_limit = 3 |
|---|
| 21 | docs.add_document('Jacob' , 'J-POP' => 10, 'J-R&B' => 6, 'Rock' => 4) |
|---|
| 22 | docs.add_document('Emma' , 'Jazz' => 8, 'Reggae'=> 9) |
|---|
| 23 | docs.add_document('Michael' , 'Classical music' => 4, 'World music' => 4) |
|---|
| 24 | docs.add_document('Isabella', 'Jazz' => 9, 'Metal' => 2, 'Reggae' => 6) |
|---|
| 25 | docs.add_document('Ethan' , 'J-POP' => 4, 'Rock' => 3, 'Hip hop' => 3) |
|---|
| 26 | docs.add_document('Emily' , 'Classical music' => 8, 'Rock' => 1) |
|---|
| 27 | |
|---|
| 28 | result = docs.do_clustering |
|---|
| 29 | #=> [["Emma", "Isabella"], ["Jacob", "Ethan"], ["Michael", "Emily"]] |
|---|
| 30 | |
|---|
| 31 | result.each do |labels| |
|---|
| 32 | puts labels.join(', ') |
|---|
| 33 | end |
|---|
| 34 | |
|---|
| 35 | docs.output_similairty_point = true
|
|---|
| 36 | result = docs.do_clustering
|
|---|
| 37 |
|
|---|
| 38 | result.each do |label_points|
|
|---|
| 39 | puts label_points.map {|label, point|
|
|---|
| 40 | "#{label}(#{point})"
|
|---|
| 41 | }.join(', ')
|
|---|
| 42 | end
|
|---|
| 43 | |
|---|
| 44 | == Project Page |
|---|
| 45 | |
|---|
| 46 | http://rubyforge.org/projects/bayon |
|---|
| 47 | |
|---|
| 48 | == Source Code |
|---|
| 49 | |
|---|
| 50 | http://coderepos.org/share/browser/lang/ruby/ruby-bayon |
|---|
| 51 | |
|---|
| 52 | == License |
|---|
| 53 | |
|---|
| 54 | bayon/Ruby is distributed under the GNU General Public License. |
|---|
| 55 | |
|---|
| 56 | see COPYING. |
|---|
| 57 | |
|---|
| 58 | == Requirements |
|---|
| 59 | |
|---|
| 60 | * {bayon - simple and fast clustering tool}[http://code.google.com/p/bayon/] |
|---|