NAME
WebService::Prismatic::InterestGraph - identify topics in web page or text
SYNOPSIS
use WebService::Prismatic::InterestGraph;
my $ig = WebService::Prismatic::InterestGraph->new( api_key => $key );
my @tags = $ig->tag_url('http://perl.org');
foreach my $tag (@tags) {
printf " %s [score: %f]\n", $tag->topic, $tag->score;
}
DESCRIPTION
This module provides a simple interface to the Prismatic Interface Graph API, which is an alpha service provided by prismatic.com. It takes a piece of text and returns a number of tags, each of which identifies a topic and a score for how likely the text includes that topic. The text can either be specified via a URL, or passed as a scalar.
Before you can use the API, you must register with Prismatic to get an api key. One you've got that, you're ready to go.
Please note: because the service is in alpha, you're currently restricted to 20 calls per minute.
Prismatic is a service which suggests things on the web that you might be interested in reading.
METHODS
new
The constructor takes an api_key
:
use WebService::Prismatic::InterestGraph;
my $ig = WebService::Prismatic::InterestGraph->new( api_key => $key );
You can also pass an HTTP user agent with the ua
parameter, but it pretty much has to be an instance of HTTP::Tiny.
tag_url( $URL )
Takes a URL and analyses the text of the referenced page. Returns a list of zero or more tags:
@tags = $ig->tag_url('http://perl.org');
The tags are instances of WebService::Prismatic::InterestGraph::Tag, data objects with the following methods:
topic: short text giving the label for a topic, such as "open source"
score: a number between 0 and 1 which says how likely it is that the text is actually about that topic.
id: a unique integer identifier for the topic.
tag_text( $TEXT [,$TITLE] )
Takes some text and an optional title string and returns a list of tags, as for tag_url()
above:
@tags = $ig->tag_url($body, $title);
SEE ALSO
Announcing the Interest Graph API - the Prismatic blog post where they announced the API.
https://github.com/Prismatic/interest-graph - the github repo which has details of the API.
getprismatic.com - the Prismatic home page.
REPOSITORY
https://github.com/neilbowers/WebService-Prismatic-InterestGraph
AUTHOR
Neil Bowers <neilb@cpan.org>
COPYRIGHT AND LICENSE
This software is copyright (c) 2015 by Neil Bowers <neilb@cpan.org>.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.