No commit activity in last 3 years
No release in over 3 years
Includes a parse method on String object
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 1.15
~> 12.3
~> 3.2
 Project Readme

TextParser

Using method parse in the String object you can parse any text.

CircleCI Gem Version

Dependencies

This gem requires ruby 1.9.2 or above.

Installation

Add this line to your application's Gemfile:

gem 'text_parser'

And then run:

`bundle install`

Or install it yourself as:

`gem install text_parser`

Usage

    'Simple, simple test'.parse
    # => [{ word: 'simple', hits: 2 }, { word: 'test', hits: 1 }]
    my_text = 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Pellentesque pretium consectetur.'
    my_text.parse(dictionary: ['dolor', 'consectetur'])
    # => [{ word: 'consectetur', hits: 2 }, { word: 'dolor', hits: 1 }]
    my_text.parse(dictionary: ['dolor', 'consectetur'], order: :word, order_direction: :desc)
    # => [{ word: 'dolor', hits: 1 }, { word: 'consectetur', hits: 2 }]
    'Lorem ipsum dolor sit amet'.parse(negative_dictionary: ['ipsum', 'dolor', 'sit'])
    # => [{ word: 'loren', hits: 1 }, { word: 'amet', hits: 1 }]
    'My test!'.parse(minimum_length: 3)
    # => [{ word: 'test', hits: 1 }]

Arguments (hash)

Key Type Default value
:dictionary Array nil
:order (:word, :hits) Symbol :word
:order_direction (:asc, :desc) Symbol :asc
:order_style (:ignore_accents, :ascii ) Symbol :ignore_accents
:negative_dictionary Array nil
:minimum_length int nil

Contributing

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Run the tests (rake test)
  4. Commit your changes (git commit -am 'Add some feature')
  5. Push to the branch (git push origin my-new-feature)
  6. Create new Pull Request