Project

moby

0.01
No commit activity in last 3 years
No release in over 3 years
Ruby interface for the world's largest free phonetic database
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

>= 0
 Project Readme

Moby

Build Status

Ruby interface for Moby Project word lists. The goal is to provide interfaces for most of the Moby Project texts and/or wordlists.

Interfaces currently provided are listed below. More to come!

Install

gem install moby

Parts of Speech

Usage

pos = Moby::PartsOfSpeech.new

List

Get word lists by part of speech

pos.nouns 
pos.plurals
pos.noun_phrases
pos.adjectives
pos.adverbs
pos.conjunctions
pos.prepositions
pos.interjections
pos.pronouns
pos.definite_articles
pos.indefinite_articles
pos.nominatives

#verbs takes an optional :type parameter since there's three types

pos.verbs
pos.verbs(:type => :all) # default
pos.verbs(:type => :usu)
pos.verbs(:type => :transitive)
pos.verbs(:type => :intransitive)  

Find

Find parts of speech info for a word

pos.find("word") 
#=> {
#=>   :word => "word", 
#=>   :code => "Nt", 
#=>   :pos => [:noun, :vert_transitive]
#=> }
  
pos.find("walk") 
#=> {
#=>   :word => "walk", 
#=>   :code => "iNt", 
#=>   :pos => [:noun, :verb_transitive, :verb_intransitive]
#=> }

Query

Check a word by part of speech

pos.noun?("animal")             #=> true
pos.verb?("run")                #=> true
pos.intransitive_verb?("walk")  #=> true
pos.adjective?("sky")           #=> false

#verb? takes an optional :type parameter (like #verbs)

pos.verb?("abandon", :type => :transitive)          #=> true
pos.verb?("overurbanized", :type => :intransitive)  #=> false
pos.verb?("overurbanized")                          #=> true

Hyphenator

Usage

hyph = Moby::Hyphenator.new

Hyphenate words

hyph.hyphenate("bardish") #=> "bard-ish"
hyph.hyphenate("hastelessness") #=> "haste-less-ness"
hyph.hyphenate("interpollinating") #=> #"in-ter-pol-li-nat-ing"

Returns the word unchanged if not found or if it shouldn't be hyphenated

hyph.hyphenate("Mordor") #=> "Mordor" (not found)
hyph.hyphenate("jest") #=> "jest" (shouldn't be hyphenated)

Thesaurus

Usage

thes = Moby::Thesaurus.new

Get related words (#syns and #related are aliases of #synonyms)

thes.synonyms("apercu") 
#=> ["a priori knowledge", "abbreviation", "abbreviature", "abrege", ... ]

thes.syns("buoyant")
#=> ["adaptable", "adaptive", "afloat", "airy", "animated", ... ]

thes.related("infiltration")
#=> ["absorbency", "absorbent", "absorption", "access", "admission", ... ]

Returns an empty array if word isn't found

thes.syns("Chewbacca") #=> []

Copyright

Copyright © 2012 Dan Richert. See LICENSE for details