Socket
Book a DemoInstallSign in
Socket

openamplify

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

openamplify

0.3.0
bundlerRubygems
Version published
Maintainers
1
Created
Source

= OpenAmplify

The OpenAmplify API reads text you supply and returns linguistic data explaining and classifying the content. What you do with that analysis is, in the fine tradition of APIs and mashups, up to you. Some possibilities might include pairing ads with articles, creating rich tag-clouds, or monitoring the tone of forum threads.

=== Supported version

2.1

== Helpful links

  • Overview: http://openamplify.com/quickstart

== Install

gem install openamplify

== Usage

=== Configure

OpenAmplify.configure do |config| config.api_key = 'YOUR_API_KEY'

# default :get
config.method = :post

# default :xml
config.output_format = :json

# default :all
config.analysis = :topics

# default :standard
config.scoring = :todo

end

Default settings can be overriden by the client

client = OpenAmplify::Client.new(:method => :get)

Or when you start 'amplifying'.

result = client.amplify('input', :output_format => :rdf)

=== Usage

client = OpenAmplify::Client.new

text = "After getting the MX1000 laser mouse and the Z-5500 speakers i fell in love with logitech" analysis = client.amplify(text) puts analysis # default as xml

It knows if the input is a URL and uses the right webservice param (ie. sourceurl)

client.amplify('http://theonion.com')

In case you need a different format, OpenAmplify supports XML, JSON, RDF, CSV. It can also return the result as a fancy HTML page.

assuming you use Nokogiri

doc = Nokogiri::XML(analysis.to_xml)

or you want a JSON

json = JSON.parse(analysis.to_json)

you should really try the pretty formats

puts analysis.to_pretty

or

puts analysis.to_signals

== Command-line

OpenAmplify gem comes with a command-line tool.

openamplify --api-key=APIKEY --format=json --analysis=topics "sample input text"

== Upgrading from 0.2.3 to 0.3.0

Note 0.3.0 is a major revamp of the code. In general, it is better but if you encounter a problem, please let me know. Or better, submit a pull request.

The following methods are deprecated and will be removed in 0.3.1

client.analyze_text('input') client.base_url = 'http://domain.dev'

The following methods are no longer supported. I figure it's better to let the caller decide how they want to traverse the results.

Treating the result as hash

response.each do |k, v| pp k pp v end

'response' works like a Hash

puts response['Topics']

Nor the shortcuts

response.top_topics response.proper_nouns response.locations response.domains

== Testing rake test OPEN_AMPLIFY_KEY=YOUR_KEY

FAQs

Package last updated on 24 Sep 2012

Did you know?

Socket

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.