bayon 0.1.0-mswin32 → 0.1.1-mswin32
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/README +9 -0
- data/lib/bayon.rb +15 -1
- data/lib/i386-mswin32/bayonext.so +0 -0
- metadata +2 -2
data/README
CHANGED
@@ -31,6 +31,15 @@ gem install bayon
|
|
31
31
|
result.each do |labels|
|
32
32
|
puts labels.join(', ')
|
33
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
|
34
43
|
|
35
44
|
== Project Page
|
36
45
|
|
data/lib/bayon.rb
CHANGED
@@ -6,6 +6,7 @@ module Bayon
|
|
6
6
|
@documents = []
|
7
7
|
@cluster_size_limit = nil
|
8
8
|
@eval_limit = nil
|
9
|
+
@output_similairty_point = nil
|
9
10
|
end
|
10
11
|
|
11
12
|
def cluster_size_limit=(limit)
|
@@ -24,6 +25,14 @@ module Bayon
|
|
24
25
|
@eval_limit = limit
|
25
26
|
end
|
26
27
|
|
28
|
+
def output_similairty_point=(output)
|
29
|
+
unless output.instance_of?(TrueClass) or output.instance_of?(FalseClass)
|
30
|
+
raise TypeError, "wrong argument type #{limit.class} (expected boolean value)"
|
31
|
+
end
|
32
|
+
|
33
|
+
@output_similairty_point = output
|
34
|
+
end
|
35
|
+
|
27
36
|
def add_document(label, features)
|
28
37
|
unless features.kind_of?(Hash)
|
29
38
|
raise TypeError, "wrong argument type #{limit.class} (expected Hash)"
|
@@ -40,6 +49,7 @@ module Bayon
|
|
40
49
|
analyzer = Analyzer.new
|
41
50
|
analyzer.set_cluster_size_limit(@cluster_size_limit) if @cluster_size_limit
|
42
51
|
analyzer.set_eval_limit(@eval_limit) if @eval_limit
|
52
|
+
analyzer.set_output_similairty_point(@output_similairty_point) if @output_similairty_point
|
43
53
|
|
44
54
|
feature_set = []
|
45
55
|
|
@@ -59,7 +69,11 @@ module Bayon
|
|
59
69
|
result = []
|
60
70
|
|
61
71
|
while (cluster = analyzer.get_next_result)
|
62
|
-
|
72
|
+
if @output_similairty_point
|
73
|
+
result << cluster.map {|doc_id, point| [@documents[doc_id][0], point] }
|
74
|
+
else
|
75
|
+
result << cluster.map {|doc_id| @documents[doc_id][0] }
|
76
|
+
end
|
63
77
|
end
|
64
78
|
|
65
79
|
return result
|
Binary file
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bayon
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: mswin32
|
6
6
|
authors:
|
7
7
|
- winebarrel
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-06-
|
12
|
+
date: 2009-06-24 00:00:00 +09:00
|
13
13
|
default_executable:
|
14
14
|
dependencies: []
|
15
15
|
|