Author image Neil Bowers
and 1 contributors


WebService::Prismatic::InterestGraph - identify topics in web page or text


 use WebService::Prismatic::InterestGraph;
 my $ig = WebService::Prismatic::InterestGraph->new( api_token => $key );
 my @tags = $ig->tag_url('');

 foreach my $tag (@tags) {
   printf " %s [score: %f]\n", $tag->topic, $tag->score;


This module provides a simple interface to the Prismatic Interface Graph API, which is an alpha service provided by 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.



The constructor takes an api_token:

 use WebService::Prismatic::InterestGraph;

 my $ig = WebService::Prismatic::InterestGraph->new( api_token => $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('');

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);


Announcing the Interest Graph API - the Prismatic blog post where they announced the API. - the github repo which has details of the API. - the Prismatic home page.



Neil Bowers <>


This software is copyright (c) 2015 by Neil Bowers <>.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.