ots 0.5.0 → 0.5.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (5) hide show
  1. data/CHANGELOG +22 -0
  2. data/README.md +4 -0
  3. data/ext/ots.c +8 -4
  4. data/ext/version.h +1 -1
  5. metadata +4 -3
@@ -0,0 +1,22 @@
1
+ === 0.5.1 (2012-01-11)
2
+
3
+ * GC bugfix: hang on to encoding index rather than rb_encoding pointer.
4
+
5
+ === 0.5.0 (2012-01-10)
6
+
7
+ api rewrite and some dictionary parser fixes
8
+
9
+ renamed:
10
+
11
+ * OTS.dictionaries => OTS.languages
12
+
13
+ api changes:
14
+
15
+ * OTS.parse, takes an options hash now with language or dictionary options
16
+ * removed OTS::Article#title
17
+ * added OTS::Article#topics, returns the most important keywords
18
+ * renamed the lines option in OTS::Article#summarize to sentences
19
+
20
+ xml parser fixes:
21
+
22
+ * uses xmlReadFile instead of xmlParseFile
data/README.md CHANGED
@@ -76,6 +76,10 @@ ots is an interface to libots - The [open text summarizer](http://libots.sourcef
76
76
  OTS.languages #=> list of supported languages dictionaries baked-in to libots
77
77
  ```
78
78
 
79
+ ## See Also
80
+
81
+ [https://github.com/ssoper/summarize](https://github.com/ssoper/summarize)
82
+
79
83
  ## License
80
84
 
81
85
  [Creative Commons Attribution - CC BY](http://creativecommons.org/licenses/by/3.0)
data/ext/ots.c CHANGED
@@ -10,6 +10,10 @@ static void article_free(OtsArticle *article) {
10
10
  ots_free_article(article);
11
11
  }
12
12
 
13
+ rb_encoding* article_encoding(VALUE self) {
14
+ return rb_enc_from_index((int)rb_iv_get(self, "@encoding"));
15
+ }
16
+
13
17
  VALUE article_allocate(VALUE klass) {
14
18
  OtsArticle *article = ots_new_article();
15
19
  return Data_Wrap_Struct(klass, 0, article_free, article);
@@ -56,7 +60,7 @@ VALUE article_initialize(int argc, VALUE *argv, VALUE self) {
56
60
  ots_parse_stream(RSTRING_PTR(text), RSTRING_LEN(text), article);
57
61
  ots_grade_doc(article);
58
62
 
59
- rb_iv_set(self, "@encoding", (VALUE)rb_enc_get(text));
63
+ rb_iv_set(self, "@encoding", (VALUE)rb_enc_get_index(text));
60
64
 
61
65
  return self;
62
66
  }
@@ -108,7 +112,7 @@ VALUE article_summarize(VALUE self, VALUE options) {
108
112
  else
109
113
  ots_highlight_doc(article, NUM2INT(percent));
110
114
 
111
- return article_summary(article, (rb_encoding *)rb_iv_get(self, "@encoding"));
115
+ return article_summary(article, article_encoding(self));
112
116
  }
113
117
 
114
118
  VALUE article_topics(VALUE self) {
@@ -116,7 +120,7 @@ VALUE article_topics(VALUE self) {
116
120
 
117
121
  return
118
122
  article->title ?
119
- rb_str_split(rb_enc_str_new2(article->title, (rb_encoding*)rb_iv_get(self, "@encoding")), ",") :
123
+ rb_str_split(rb_enc_str_new2(article->title, article_encoding(self)), ",") :
120
124
  Qnil;
121
125
  }
122
126
 
@@ -129,7 +133,7 @@ typedef struct {
129
133
 
130
134
  VALUE article_keywords(VALUE self) {
131
135
  OtsArticle *article = article_handle(self);
132
- rb_encoding *encoding = (rb_encoding*)rb_iv_get(self, "@encoding");
136
+ rb_encoding *encoding = article_encoding(self);
133
137
 
134
138
  VALUE words = rb_ary_new();
135
139
  GList* word_ptr = article->ImpWords;
@@ -1,2 +1,2 @@
1
1
  #pragma once
2
- #define RUBY_OTS_VERSION "0.5.0"
2
+ #define RUBY_OTS_VERSION "0.5.1"
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 5
8
- - 0
9
- version: 0.5.0
8
+ - 1
9
+ version: 0.5.1
10
10
  platform: ruby
11
11
  authors:
12
12
  - Bharanee Rathna
@@ -14,7 +14,7 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2012-01-10 00:00:00 +11:00
17
+ date: 2012-01-11 00:00:00 +11:00
18
18
  default_executable:
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
@@ -75,6 +75,7 @@ files:
75
75
  - test/test_ots.rb
76
76
  - test/helper.rb
77
77
  - README.md
78
+ - CHANGELOG
78
79
  - dictionaries/cy.xml
79
80
  - dictionaries/tr.xml
80
81
  - dictionaries/fr.xml