Permalink
Browse files

Included examples with stopword? method and Sieve class

  • Loading branch information...
1 parent c926092 commit a60baba5a310fd439e9f544dbc505e5d86ae4eb2 @brenes committed Feb 3, 2013
Showing with 29 additions and 3 deletions.
  1. +29 −3 README.md
View
32 README.md
@@ -29,15 +29,36 @@ in your Gemfile.
```
stopwords = ['by', 'written', 'from']
filter = Stopwords::Filter.new stopwords
-filter.filter 'guide by douglas adams'.split #-> ['guide', 'douglas', 'adams']
+
+filter.filter 'guide by douglas adams'.split
+# ['guide', 'douglas', 'adams']
+
+filter.stopword? 'by'
+# true
```
2. Snowball version
```
filter = Stopwords::Snowball::Filter.new "en"
-filter.filter 'guide by douglas adams'.split #-> ['guide', 'douglas', 'adams']
+filter.filter 'guide by douglas adams'.split
+# ['guide', 'douglas', 'adams']
+
+filter.stopword? 'by'
+# true
+```
+
+ 2.1 Snowball version with Sieve class (thanks to @s2gatev)
+
+```ruby
+sieve = Stopwords::Snowball::WordSieve.new
+
+filtered = sieve.filter lang: :en, words: 'guide by douglas adams'.split
+# filtered = ['guide', 'douglas', 'adams']
+
+sieve.stopword? lang: :en, word: 'by'
+# true
```
@@ -103,11 +124,16 @@ Anything else?
In a future version I would like to include a chaining filter where you include a series of operations and they are executed in a lineal order, just like the [Pipes and Filters design pattern][wikipedia_pipes_filters]
+Ackonowledgments
+----------------
+
+Thanks to @s2gatev who added the `stopword?` method and the sieve class to this gem
[wikipedia_stopwords]: http://en.wikipedia.org/wiki/Stopword
[solr]: https://github.com/sunspot/sunspot
[sphinx]: https://github.com/freelancing-god/thinking-sphinx
[google]: https://github.com/alexreisner/google_custom_search
[postgre]: https://github.com/Casecommons/pg_search
[wikipedia_snowball]: http://en.wikipedia.org/wiki/Snowball_programming_language
- [wikipedia_pipes_filters]: http://en.wikipedia.org/wiki/Pipes_and_filters
+ [wikipedia_pipes_filters]: http://en.wikipedia.org/wiki/Pipes_and_filters
+

0 comments on commit a60baba

Please sign in to comment.