Skip to content

tkellen/ruby-ngram

master
Switch branches/tags
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
lib
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

ngram Build Status

Break words and phrases into ngrams.

Setup

gem install ngram

Usage

require 'ngram'

# these are default settings
ngram = NGram.new({
  :size => 2,
  :word_separator => " ",
  :padchar => "_"
})
# => #<NGram:0x10d9877f0 @padchar="_", @separator=" ", @size=2>

ngram.parse('test')
# => ["__", "_t", "te", "es", "st", "t_", "__"]
ngram.parse('test phrase')
# => [["_t", "te", "es", "st", "t_"], ["_p", "ph", "hr", "ra", "as", "se", "e_"]]

Copyright (c) 2013 Tyler Kellen. See LICENSE for further details.

About

Break words and phrases into ngrams.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages