By Karen Lundgren
Version 0.2.0

Tokenizes strings for use in social applications.


5375 (1390 for this version)



Social Tokenizer

Gem Version Build Status Coverage Status


First, add the gem to your Gemfile

gem 'social_tokenizer'

Next, run the following commands

> bundle install
> rails g social_tokenizer:install


When chained onto the end of a string:

string_to_tokenize = 'This string contains a @mention and a #tag.'
hash_of_tokens = string_to_tokenize.social_tokenize

By accessing the object directly:

lang = :de
social_tokenizer =
hash_of_tokens = social_tokenizer.social_tokenize(self)

Special configuration

Arbitrary token types can be defined in initializers/social_tokenizer.rb like this: /^\+(.*)$/, replacement: '\1', key: :rate_up) /^\-(.*)$/, replacement: '\1', key: :rate_down)

Contributing to Social Tokenizer

  • Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet.
  • Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it.
  • Fork the project.
  • Start a feature/bugfix branch.
  • Commit and push until you are happy with your contribution.
  • Make sure to add tests for it. This is important so I don't break it in a future version unintentionally.
  • Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.


Copyright (c) 2014 Gem Vein. See LICENSE.txt for further details.

Top Gems