Skip to content
Binary file modified .config.properties.enc
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
import com.ibm.watson.developer_cloud.alchemy.v1.AlchemyLanguage;
import com.ibm.watson.developer_cloud.alchemy.v1.model.DocumentSentiment;
import com.ibm.watson.developer_cloud.alchemy.v1.model.Entities;
import com.ibm.watson.developer_cloud.alchemy.v1.model.TypedRelations;

public class AlchemyLanguageExample {

Expand All @@ -31,12 +32,18 @@ public static void main(String[] args) {
params.put(AlchemyLanguage.TEXT,
"IBM Watson won the Jeopardy television show hosted by Alex Trebek");

// get sentiment
DocumentSentiment sentiment = service.getSentiment(params).execute();
System.out.println("Sentiment: " + sentiment);


// get entities
Entities entities = service.getEntities(params).execute();
System.out.println("Entities: " + entities);

// get typed relations
TypedRelations relations = service.getTypedRelations(params).execute();
System.out.println("Relations: " + relations);

}

}
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public static class EnrichedTitle extends GenericModel {
private Sentiment sentiment;
private List<Taxonomy> taxonomy;


/**
* Gets the concepts.
*
Expand All @@ -64,6 +64,7 @@ public List<Entity> getEntities() {
public List<Keyword> getKeywords() {
return keywords;
}

/**
* Gets the relations.
*
Expand All @@ -72,7 +73,7 @@ public List<Keyword> getKeywords() {
public List<SAORelation> getRelations() {
return relations;
}

/**
* Gets the sentiment.
*
Expand Down Expand Up @@ -200,6 +201,7 @@ public List<Concept> getConcepts() {
public EnrichedTitle getEnrichedTitle() {
return enrichedTitle;
}

/**
* Gets the entities.
*
Expand All @@ -208,6 +210,7 @@ public EnrichedTitle getEnrichedTitle() {
public List<Entity> getEntities() {
return entities;
}

/**
* Gets the feeds.
*
Expand All @@ -216,6 +219,7 @@ public List<Entity> getEntities() {
public List<Feed> getFeeds() {
return feeds;
}

/**
* Gets the image.
*
Expand All @@ -224,6 +228,7 @@ public List<Feed> getFeeds() {
public String getImage() {
return image;
}

/**
* Gets the image keywords.
*
Expand All @@ -232,6 +237,7 @@ public String getImage() {
public List<ImageKeyword> getImageKeywords() {
return imageKeywords;
}

/**
* Gets the keywords.
*
Expand All @@ -240,6 +246,7 @@ public List<ImageKeyword> getImageKeywords() {
public List<Keyword> getKeywords() {
return keywords;
}

/**
* Gets the language.
*
Expand All @@ -248,6 +255,7 @@ public List<Keyword> getKeywords() {
public String getLanguage() {
return language;
}

/**
* Gets the publication date.
*
Expand All @@ -256,6 +264,7 @@ public String getLanguage() {
public PublicationDate getPublicationDate() {
return publicationDate;
}

/**
* Gets the relations.
*
Expand All @@ -264,6 +273,7 @@ public PublicationDate getPublicationDate() {
public List<SAORelation> getRelations() {
return relations;
}

/**
* Gets the sentiment.
*
Expand All @@ -272,6 +282,7 @@ public List<SAORelation> getRelations() {
public Sentiment getSentiment() {
return sentiment;
}

/**
* Gets the taxonomy.
*
Expand All @@ -280,6 +291,7 @@ public Sentiment getSentiment() {
public List<Taxonomy> getTaxonomy() {
return taxonomy;
}

/**
* Gets the text.
*
Expand All @@ -288,6 +300,7 @@ public List<Taxonomy> getTaxonomy() {
public String getText() {
return text;
}

/**
* Gets the title.
*
Expand All @@ -296,6 +309,7 @@ public String getText() {
public String getTitle() {
return title;
}

/**
* Gets the url.
*
Expand All @@ -304,6 +318,7 @@ public String getTitle() {
public String getUrl() {
return url;
}

/**
* Sets the author.
*
Expand All @@ -322,7 +337,7 @@ public void setCleanedTitle(String cleanedTitle) {
this.cleanedTitle = cleanedTitle;
}


/**
* Sets the concepts.
*
Expand All @@ -349,7 +364,7 @@ public void setEnrichedTitle(EnrichedTitle enrichedTitle) {
public void setEntities(List<Entity> entities) {
this.entities = entities;
}

/**
* Sets the feeds.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ public String getText() {
* @param hierarchy The hierarchy.
*/
public void setHierarchy(String hierarchy) {
if(knowledgeGraph == null) {
if (knowledgeGraph == null) {
knowledgeGraph = new KnowledgeGraph();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
package com.ibm.watson.developer_cloud.alchemy.v1.model;

import com.google.gson.annotations.JsonAdapter;

import com.ibm.watson.developer_cloud.service.model.GenericModel;
import com.ibm.watson.developer_cloud.util.BooleanToStringTypeAdapter;

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
/**
* Copyright 2015 IBM Corp. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
* in compliance with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under the License
* is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
* or implied. See the License for the specific language governing permissions and limitations under
* the License.
*/
package com.ibm.watson.developer_cloud.alchemy.v1.model;

import java.util.List;

import com.ibm.watson.developer_cloud.alchemy.v1.AlchemyLanguage;
import com.ibm.watson.developer_cloud.service.model.GenericModel;

/**
* Argument of a typed relation. It includes the detected {@link TypedEntity}, text and part.
*
* @see AlchemyLanguage#getTypedRelations(java.util.Map)
*/
public class TypedArguments extends GenericModel {

private String part;
private String text;
private List<TypedEntity> entities;

/**
* Gets the entities.
*
* @return the entities
*/
public List<TypedEntity> getEntities() {
return entities;
}

/**
* Sets the entities.
*
* @param entities the new entities
*/
public void setTypedEntities(List<TypedEntity> entities) {
this.entities = entities;
}

/**
* Gets the part.
*
* @return the part
*/
public String getPart() {
return part;
}

/**
* Sets the part.
*
* @param part the new part
*/
public void setPart(String part) {
this.part = part;
}

/**
* Gets the text.
*
* @return the text
*/
public String getText() {
return text;
}

/**
* Sets the text.
*
* @param text the new text
*/
public void setText(String text) {
this.text = text;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -14,20 +14,17 @@

package com.ibm.watson.developer_cloud.alchemy.v1.model;

import com.google.gson.annotations.SerializedName;
import com.ibm.watson.developer_cloud.alchemy.v1.AlchemyLanguage;
import com.ibm.watson.developer_cloud.service.model.GenericModel;

/**
* Recognized entity from {@link AlchemyLanguage#getTypedRelations(java.util.Map)}
*/
public class TypedEntity {
public class TypedEntity extends GenericModel {

private String id;
private String text;
private String mention;
private String type;
@SerializedName("argNum")
private Integer argumentNumber;
private String id;

/**
* Gets the text.
Expand All @@ -47,24 +44,6 @@ public void setText(String text) {
this.text = text;
}

/**
* Gets the mention.
*
* @return The mention
*/
public String getMention() {
return mention;
}

/**
* Sets the mention.
*
* @param mention The mention
*/
public void setMention(String mention) {
this.mention = mention;
}

/**
* Gets the type.
*
Expand All @@ -83,24 +62,6 @@ public void setType(String type) {
this.type = type;
}

/**
* Gets the argument number.
*
* @return The argument number
*/
public Integer getArgumentNumber() {
return argumentNumber;
}

/**
* Sets the argument number.
*
* @param argumentNumber the new argument number
*/
public void setArgumentNumber(Integer argumentNumber) {
this.argumentNumber = argumentNumber;
}

/**
* Gets the id.
*
Expand Down
Loading