Attensadev / j-calais

Automatically exported from code.google.com/p/j-calais
Apache License 2.0
0 stars 0 forks source link

openCalais SocialTags available within API? #1

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
It would be great to access the "SocialTags" from the API

Original issue reported on code.google.com by zack...@gmail.com on 8 Nov 2010 at 8:05

GoogleCodeExporter commented 9 years ago

Original comment by elmer.garduno@gmail.com on 8 Nov 2010 at 4:02

GoogleCodeExporter commented 9 years ago
I added it myself, luckily it was pretty easy:

###########################
in CalaisResponse.java:
add new method:

Iterable<CalaisObject> getSocialTags();

#######################
in CalaisRestClient.java:132
add:

 final Iterable<CalaisObject> socialTags = Iterables  .unmodifiableIterable(hierarchy.get("socialTag"));

#####################
in CalaisRestClient.java:145
add to new CalaisResponse

public Iterable<CalaisObject> getSocialTags() { return socialTags; }

#####################
example useage:
make sure you pass in a CalaisConfig with socialtags enabled:
CalaisConfig config = new CalaisConfig();
config.set(CalaisConfig.ProcessingParam.ENABLE_METADATA_TYPE, 
"GenericRelations,SocialTags");

CalaisResponse response = client.analyze(myString,config);
 for (CalaisObject tags : response.getSocialTags()){
                 System.out.println(tags.getField("_typeGroup") + ":" + tags.getField("name"));
}

Original comment by zack...@gmail.com on 8 Nov 2010 at 9:22

GoogleCodeExporter commented 9 years ago
Thank you zack, I have added your changes to the svn trunk.

Original comment by elmer.garduno@gmail.com on 8 Nov 2010 at 10:02

GoogleCodeExporter commented 9 years ago
Released in version 0.2.1

Original comment by elmer.garduno@gmail.com on 17 May 2011 at 2:51