License
Copyright 2015 The MITRE Corporation. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and zlimitations under the License.”
medattrib
Description
A replacement for MedAttrib.pl.
The MedAttrib class method parse(text) returns an AnnotatedString which contains the original text and a list of the tags found. Because "doseamount" depends on the presence of other tags, the taggers have been split into pre- and post-doseamount taggers.
Example usage
MedAttrib can be accessed either directly by Ruby code or as a command line executable.
To use the library in Ruby:
```require "medattrib" tagger = MedAttrib.new annotated_string = tagger.parse("take daily.")
annotated_string is now "take daily." with a "freq" tag labeling "daily" in standoff annotation (class AnnotatedString). This can be printed as inline xml using AnnotatedString#to_s:
Then inspect the output of "annotated_string":
```ruby
puts annotated_string
And you should get output similar to this:
#=> "take <freq normalized='qd'>daily</freq>."
Alternatively, the command line executable tags text line by line, and reads from standard in and writes to standard out.
``` $ medattrib
take daily.
take
## Running tests
To run all the tests:
```bash
rake test
To run a specific test:
ruby -I'lib:test' test/test_medattrib.rb -n test_no_sub_tag
Building and install gem
Build your gem:
gem build medattrib.gemspec
Install your gem:
gem install medattrib-0.0.3.gem