-
Notifications
You must be signed in to change notification settings - Fork 13
Tagging in ruby
danieldk edited this page Oct 30, 2010
·
1 revision
The Ruby binding for Citar provides an easy to use Ruby module for interacting with the Citar library. The Ruby module can be retrieved via git, and is part of the regular citar distribution:
git clone git://github.com/langkit/citar.git
The module can then be installed by executing the following commands in the ruby subdirectory:
gem build citar.gemspec
gem install citar
For actual use of this module, the Citar tagger library should be installed.
Use of the Ruby Citar module is straightforward: first construct a using the constructor of the Citar::Tagger class, providing the paths of the lexicon and the ngram model. Afterwards, the tag of the constructed instance can be used to tag a sentence. For example:
> require 'citar'
=> true
> tagger = Citar::Tagger.new('../citar/models/brown/brown-simplified.lexicon',
'../citar/models/brown/brown-simplified.ngrams')
=> #<Citar::Tagger:0x7fd210721c28 @tagger=#<FFI::Pointer address=0x16e4bb0>>
> tagger.tag(['The', 'cat', 'is', 'on', 'the', 'mat', '.'])
=> ["AT", "NN", "BEZ", "IN", "AT", "NN", "."]