Skip to content
This repository was archived by the owner on Oct 30, 2018. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 0 additions & 4 deletions example/combined.pl
Original file line number Diff line number Diff line change
Expand Up @@ -30,28 +30,24 @@

# Image, targeted sentiment, entity, keyword, title, author, taxonomy,
# concept, quotations, clean text
$combinedParams->SetExtractMode("always-infer");
$combinedParams->SetExtract("page-image,entity,keyword,title,author,taxonomy,concept");
$result = $alchemyObj->URLGetCombinedData("http://cnnworldlive.cnn.com/Event/Crisis_in_Ukraine_2?hpt=hp_t1&iid=article_sidebar",
$combinedParams);
printf $result;

# Clean text, title, image (more CPU intensive, more accurate)
$combinedParams->SetExtractMode("always-infer");
$combinedParams->SetExtract("page-image,title");
$result = $alchemyObj->URLGetCombinedData("http://www.zdnet.com/at-and-t-rebuffs-netflix-ceos-net-neutrality-defense-7000027584/",
$combinedParams);
printf $result;

# Clean text, title, image (less CPU intensive, less accurate)
$combinedParams->SetExtractMode("trust-metadata");
$combinedParams->SetExtract("page-image,title");
$result = $alchemyObj->URLGetCombinedData("http://www.eonline.com/news/523881/kim-kardashian-stuns-on-vogue-check-out-her-6-hottest-magazine-covers",
$combinedParams);
printf $result;

# Get data on some text
$combinedParams->SetExtractMode("trust-metadata");
$combinedParams->SetExtract("entity,keyword,title,taxonomy,concept");
$result = $alchemyObj->TextGetCombinedData("A second day of searching for sightings of possible debris from a missing Malaysian airliner in the southern Indian Ocean has proved fruitless.", $combinedParams);
printf $result;
8 changes: 1 addition & 7 deletions example/image_extract.pl
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,7 @@

my $imageParams = new AlchemyAPI_ImageParams();

# Get the image from a URL, using the more CPU intensive (and more accurate) approach
$imageParams->SetExtractMode("always-infer");
$result = $alchemyObj->URLGetImage("http://www.umich.edu/", $imageParams);
printf $result;

# Get the image from a URL, using the less CPU intensive (and less accurate) approach
$imageParams->SetExtractMode("trust-metadata");
# Get the image from a URL
$result = $alchemyObj->URLGetImage("http://www.umich.edu/", $imageParams);
printf $result;

Expand Down
11 changes: 0 additions & 11 deletions example/image_keywords.pl
Original file line number Diff line number Diff line change
Expand Up @@ -30,17 +30,6 @@

# Let's try giving the URL call an HTML page, as it should
# extract the most relevant image before providing relevant keywords
$imageParams->SetExtractMode("trust-metadata");
$result = $alchemyObj->URLGetRankedImageKeywords("http://www.cnn.com/", $imageParams);
printf $result;

# Change the extractMode parameter
$imageParams->SetExtractMode("always-infer");
$result = $alchemyObj->URLGetRankedImageKeywords("http://www.cnn.com/", $imageParams);
printf $result;

# Change the extractMode parameter
$imageParams->SetExtractMode("only-metadata");
$result = $alchemyObj->URLGetRankedImageKeywords("http://www.cnn.com/", $imageParams);
printf $result;

Expand Down
25 changes: 0 additions & 25 deletions module/lib/AlchemyAPI_CombinedParams.pm
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ sub new() {
my $class = shift;

my $self = {
_extractMode => undef,
_extract => undef,
_outputMode => AlchemyAPI_BaseParams::OUTPUT_MODE_XML,
#_jsonp => undef,
Expand All @@ -47,26 +46,6 @@ sub new() {
return $self;
}

sub SetExtractMode {
my($self, $extractMode) = @_;

if ( "trust-metadata" eq $extractMode ||
"always-infer" eq $extractMode )
{
$self->{_extractMode} = $extractMode;
}
else
{
throw Error::Simple("Error: Cannot set extractMode to ".$extractMode);
}
}

sub GetExtractMode
{
my($self) = @_;
return $self->{_extractMode};
}

sub SetExtract
{
my($self, $extract) = @_;
Expand Down Expand Up @@ -234,10 +213,6 @@ sub GetParameterString {
my($self) = @_;
my $retString = $self->SUPER::GetParameterString();

if( defined $self->{_extractMode} )
{
$retString .= "&extractMode=".$self->{_extractMode};
}
if( defined $self->{_extract} )
{
$retString .= "&extract=".$self->{_extract};
Expand Down
26 changes: 0 additions & 26 deletions module/lib/AlchemyAPI_ImageKeywordParams.pm
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ sub new() {
my $class = shift;

my $self = {
_extractMode => undef,
_outputMode => AlchemyAPI_BaseParams::OUTPUT_MODE_XML,
_image => undef,
_imagePostMode => undef,
Expand All @@ -39,27 +38,6 @@ sub new() {
return $self;
}

sub SetExtractMode {
my($self, $extractMode) = @_;

if ( "only-metadata" eq $extractMode ||
"trust-metadata" eq $extractMode ||
"always-infer" eq $extractMode )
{
$self->{_extractMode} = $extractMode;
}
else
{
throw Error::Simple("Error: Cannot set extractMode to ".$extractMode);
}
}

sub GetExtractMode
{
my($self) = @_;
return $self->{_extractMode};
}

sub SetImagePostMode {
my($self, $imagePostMode) = @_;

Expand Down Expand Up @@ -96,10 +74,6 @@ sub GetParameterString {
my($self) = @_;
my $retString = $self->SUPER::GetParameterString();

if( defined $self->{_extractMode} )
{
$retString .= "&extractMode=".$self->{_extractMode};
}
if( defined $self->{_image} )
{
$retString .= "&image=".$self->{_image};
Expand Down
24 changes: 0 additions & 24 deletions module/lib/AlchemyAPI_ImageParams.pm
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ sub new() {
my $class = shift;

my $self = {
_extractMode => undef,
_outputMode => AlchemyAPI_BaseParams::OUTPUT_MODE_XML,
};

Expand All @@ -37,34 +36,11 @@ sub new() {
return $self;
}

sub SetExtractMode {
my($self, $extractMode) = @_;

if ( "trust-metadata" eq $extractMode ||
"always-infer" eq $extractMode )
{
$self->{_extractMode} = $extractMode;
}
else
{
throw Error::Simple("Error: Cannot set extractMode to ".$extractMode);
}
}

sub GetExtractMode
{
my($self) = @_;
return $self->{_extractMode};
}

sub GetParameterString {
my($self) = @_;
my $retString = $self->SUPER::GetParameterString();

if( defined $self->{_extractMode} )
{
$retString .= "&extractMode=".$self->{_extractMode};
}
return $retString;
}
1;
Expand Down