
Security News
Follow-up and Clarification on Recent Malicious Ruby Gems Campaign
A clarification on our recent research investigating 60 malicious Ruby gems.
nlg_xml_realiser_builder
Advanced tools
This is still not a full featured builder for Simple NLG but the goal is to make it easier to compose the XML Realiser recordings.
There is an online service at https://nlg-service.herokuapp.com which embeds SimpleNLG in a web service.
Check out nlg-service to see the Rails-API running under JRuby.
Add this line to your application's Gemfile:
gem 'nlg_xml_realiser_builder'
And then execute:
$ bundle
Or install it yourself as:
$ gem install nlg_xml_realiser_builder
The XML Realiser format can be checked through it's XML Schema which is roughly implemented in this DSL, with most of the relevant attributes validations as well.
The usage is mainly nesting the main builder elements:
sp(tag, options, &block)
np(tag, noun, options, &block)
vp(tag, verb, options, &block)
adj(tag, adjective, options, &block)
adv(tag, adverb, options, &block)
pp(tag, preposition, options, &block)
cp(tag, options, &block)
Example:
dsl = NlgXmlRealiserBuilder::DSL.new
dsl.builder(true) do
sp :child do
subj :np, 'there', cat: 'ADVERB'
verb 'be' do
compl [ 'a', 'restenosis' ] do
preMod :cp, conj: ',' do
coord :adj, 'eccentric'
coord :adj, 'tubular'
end
postMod :str, '(18 mm x 1 mm)'
end
postMod :pp, 'from' do
preMod :vp, 'extend', FORM: 'GERUND'
compl ['the'] do
preMod :adj, 'proximal'
end
postMod :pp, 'to' do
compl [ 'a', 'right coronary artery' ] do
preMod :adj, 'mid'
end
end
end
postMod :pp, 'with' do
compl :np, 'TIMI 1 flow'
end
end
end
end.to_xml
Resulting XML:
<?xml version="1.0"?>
<NLGSpec xmlns="http://simplenlg.googlecode.com/svn/trunk/res/xml" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<Recording>
<Record>
<Document cat="PARAGRAPH">
<child xsi:type="SPhraseSpec">
<subj xsi:type="NPPhraseSpec">
<head cat="ADVERB">
<base>there</base>
</head>
</subj>
<vp xsi:type="VPPhraseSpec">
<head cat="VERB">
<base>be</base>
</head>
<compl xsi:type="NPPhraseSpec">
<head cat="NOUN">
<base>restenosis</base>
</head>
<spec cat="DETERMINER">
<base>a</base>
</spec>
<preMod xsi:type="CoordinatedPhraseElement" conj=",">
<coord xsi:type="AdjPhraseSpec">
<head cat="ADJECTIVE">
<base>eccentric</base>
</head>
</coord>
<coord xsi:type="AdjPhraseSpec">
<head cat="ADJECTIVE">
<base>tubular</base>
</head>
</coord>
</preMod>
<postMod xsi:type="StringElement">
<val>(18 mm x 1 mm)</val>
</postMod>
</compl>
<postMod xsi:type="PPPhraseSpec">
<head cat="PREPOSITION">
<base>from</base>
</head>
<preMod xsi:type="VPPhraseSpec" FORM="GERUND">
<head cat="VERB">
<base>extend</base>
</head>
</preMod>
<compl xsi:type="NPPhraseSpec">
<spec cat="DETERMINER">
<base>the</base>
</spec>
<preMod xsi:type="AdjPhraseSpec">
<head cat="ADJECTIVE">
<base>proximal</base>
</head>
</preMod>
</compl>
<postMod xsi:type="PPPhraseSpec">
<head cat="PREPOSITION">
<base>to</base>
</head>
<compl xsi:type="NPPhraseSpec">
<head cat="NOUN">
<base>right coronary artery</base>
</head>
<spec cat="DETERMINER">
<base>a</base>
</spec>
<preMod xsi:type="AdjPhraseSpec">
<head cat="ADJECTIVE">
<base>mid</base>
</head>
</preMod>
</compl>
</postMod>
</postMod>
<postMod xsi:type="PPPhraseSpec">
<head cat="PREPOSITION">
<base>with</base>
</head>
<compl xsi:type="NPPhraseSpec">
<head cat="NOUN">
<base>TIMI 1 flow</base>
</head>
</compl>
</postMod>
</vp>
</child>
</Document>
</Record>
</Recording>
</NLGSpec>
From here you can use the NLG Service Web Service to transform this XML into a grammatically and ortographically correct natural English phrase.
After checking out the repo, run bin/setup
to install dependencies. Then, run rake spec
to run the tests. You can also run bin/console
for an interactive prompt that will allow you to experiment.
To install this gem onto your local machine, run bundle exec rake install
. To release a new version, update the version number in version.rb
, and then run bundle exec rake release
, which will create a git tag for the version, push git commits and tags, and push the .gem
file to rubygems.org.
You can use the NLG Web Service from the bin/console
using:
NlgXmlRealiserBuilder.test_post(builder.to_xml)
It should return a properly realised English phrase.
Bug reports and pull requests are welcome on GitHub at https://github.com/Codeminer42/nlg_xml_realiser_builder.
Author: Fabio Akita Copyright 2016 (C) Codeminer 42
The gem is available as open source under the terms of the LGPL-3.0 License.
FAQs
Unknown package
We found that nlg_xml_realiser_builder demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
A clarification on our recent research investigating 60 malicious Ruby gems.
Security News
ESLint now supports parallel linting with a new --concurrency flag, delivering major speed gains and closing a 10-year-old feature request.
Research
/Security News
A malicious Go module posing as an SSH brute forcer exfiltrates stolen credentials to a Telegram bot controlled by a Russian-speaking threat actor.