MITIE
MITIE - named-entity recognition - for Ruby
Installation
First, install MITIE. For Homebrew, use:
brew install mitie
Add this line to your application’s Gemfile:
gem 'mitie'
And download the pre-trained model for your language:
Getting Started
Get your text
text = "Nat Friedman is the CEO of GitHub, which is headquartered in San Francisco"
Load an NER model
model = Mitie::NER.new("ner_model.dat")
Get entities
model.entities(text)
This returns
[
{text: "Nat Friedman", tag: "PERSON", score: 1.099661347535191, offset: 0},
{text: "GitHub", tag: "ORGANIZATION", score: 0.344641651251650, offset: 27},
{text: "San Francisco", tag: "LOCATION", score: 1.428241888939011, offset: 61}
]
Get tokens
model.tokens(text)
Get tokens and their offset
model.tokens_with_offset(text)
Get all tags for a model
model.
History
View the changelog
Contributing
Everyone is encouraged to help improve this project. Here are a few ways you can help:
- Report bugs
- Fix bugs and submit pull requests
- Write, clarify, or fix documentation
- Suggest or add new features
To get started with development:
git clone https://github.com/ankane/mitie.git
cd mitie
bundle install
MITIE_NER_PATH=path/to/ner_model.dat bundle exec rake test