8000 GitHub - lengio/lemmatizer: Lemmatizer for text in English. Inspired by Python's nltk.corpus.reader.wordnet.morphy
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Lemmatizer for text in English. Inspired by Python's nltk.corpus.reader.wordnet.morphy

License

Notifications You must be signed in to change notification settings

lengio/lemmatizer

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

25 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

lemmatizer

Lemmatizer for text in English. Inspired by Python's nltk.corpus.reader.wordnet.morphy package.

Based on code posted by mtbr at his blog entry WordNet-based lemmatizer

Installation

sudo gem install lemmatizer

Usage

require "lemmatizer"

lem = Lemmatizer.new

p lem.lemma("dogs",    :noun ) # => "dog"
p lem.lemma("hired",   :verb ) # => "hire"
p lem.lemma("hotter",  :adj  ) # => "hot"

# when part-of-speech symbol is not specified as the second argument,
# lemmatizer tries :verb, :noun, :adj, and :adv one by one in this order.
p lem.lemma("fired")           # => "fire"
p lem.lemma("slow")            # => "slow"

Limitations

# Lemmatizer leaves alone words that its dictionary does not contain.
# This keeps proper names such as "James" intact.
p lem.lemma("MacBooks", :noun) # => "MacBooks"

# If an inflected form is included as a lemma in the word index,
# lemmatizer may not give an expected result.
p lem.lemma("higher", :adj) # => "higher" not "high"!

# The above has to happen because "higher" is itself an entry word listed in dict/index.adj .
# Modify dict/index.{noun|verb|adj|adv} if necessary.

Author

Thanks for assistance and contributions:

License

Licensed under the MIT license.

About

Lemmatizer for text in English. Inspired by Python's nltk.corpus.reader.wordnet.morphy

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Ruby 100.0%
0