Skip to content

Commit

Permalink
Merge pull request Azure#20 from mssfang/Entities-API
Browse files Browse the repository at this point in the history
Entities api
  • Loading branch information
mssfang authored Dec 13, 2019
2 parents cf74e78 + 5f5c198 commit 56848e2
Show file tree
Hide file tree
Showing 32 changed files with 834 additions and 316 deletions.

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public final class DocumentSentiment {
* sentiment class.
*/
@JsonProperty(value = "documentScores", required = true)
private Object documentScores;
private SentimentConfidenceScorePerLabel documentScores;

/*
* Sentence level sentiment analysis.
Expand Down Expand Up @@ -117,7 +117,7 @@ public DocumentSentiment setStatistics(TextDocumentStatistics statistics) {
*
* @return the documentScores value.
*/
public Object getDocumentScores() {
public SentimentConfidenceScorePerLabel getDocumentScores() {
return this.documentScores;
}

Expand All @@ -128,7 +128,7 @@ public Object getDocumentScores() {
* @param documentScores the documentScores value to set.
* @return the DocumentSentiment object itself.
*/
public DocumentSentiment setDocumentScores(Object documentScores) {
public DocumentSentiment setDocumentScores(SentimentConfidenceScorePerLabel documentScores) {
this.documentScores = documentScores;
return this;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@

package com.azure.ai.textanalytics.implementation.models;

import com.azure.core.annotation.Fluent;
import com.azure.ai.textanalytics.models.TextBatchStatistics;
import com.azure.core.annotation.Fluent;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.util.List;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@

package com.azure.ai.textanalytics.implementation.models;

import com.azure.core.annotation.Fluent;
import com.azure.ai.textanalytics.models.TextBatchStatistics;
import com.azure.core.annotation.Fluent;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.util.List;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@

package com.azure.ai.textanalytics.implementation.models;

import com.azure.core.annotation.Fluent;
import com.azure.ai.textanalytics.models.TextBatchStatistics;
import com.azure.core.annotation.Fluent;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.util.List;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@

package com.azure.ai.textanalytics.implementation.models;

import com.azure.core.annotation.Fluent;
import com.azure.ai.textanalytics.models.TextBatchStatistics;
import com.azure.core.annotation.Fluent;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.util.List;

Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public final class SentenceSentiment {
* classes.
*/
@JsonProperty(value = "sentenceScores", required = true)
private Object sentenceScores;
private SentimentConfidenceScorePerLabel sentenceScores;

/*
* The sentence offset from the start of the document.
Expand Down Expand Up @@ -73,7 +73,7 @@ public SentenceSentiment setSentiment(String sentiment) {
*
* @return the sentenceScores value.
*/
public Object getSentenceScores() {
public SentimentConfidenceScorePerLabel getSentenceScores() {
return this.sentenceScores;
}

Expand All @@ -84,7 +84,7 @@ public Object getSentenceScores() {
* @param sentenceScores the sentenceScores value to set.
* @return the SentenceSentiment object itself.
*/
public SentenceSentiment setSentenceScores(Object sentenceScores) {
public SentenceSentiment setSentenceScores(SentimentConfidenceScorePerLabel sentenceScores) {
this.sentenceScores = sentenceScores;
return this;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

package com.azure.ai.textanalytics.implementation.models;

import com.azure.ai.textanalytics.models.TextBatchStatistics;
import com.azure.core.annotation.Fluent;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.util.List;
Expand All @@ -29,7 +30,7 @@ public final class SentimentResponse {
* The statistics property.
*/
@JsonProperty(value = "statistics")
private RequestStatistics statistics;
private TextBatchStatistics statistics;

/*
* This field indicates which model is used for scoring.
Expand Down Expand Up @@ -82,7 +83,7 @@ public SentimentResponse setErrors(List<DocumentError> errors) {
*
* @return the statistics value.
*/
public RequestStatistics getStatistics() {
public TextBatchStatistics getStatistics() {
return this.statistics;
}

Expand All @@ -92,7 +93,7 @@ public RequestStatistics getStatistics() {
* @param statistics the statistics value to set.
* @return the SentimentResponse object itself.
*/
public SentimentResponse setStatistics(RequestStatistics statistics) {
public SentimentResponse setStatistics(TextBatchStatistics statistics) {
this.statistics = statistics;
return this;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,17 @@
/**
* The KeyPhraseResult model.
*/
// TODO (shawn): Should be @Immutable, but will produce spotbug/checkstyle error
@Fluent
public final class KeyPhraseResult extends DocumentResult {
private List<String> keyPhrases;

// TODO(shawn): not public modifier
public KeyPhraseResult(String id, Error error, boolean isError) {
super(id, error, isError);
keyPhrases = null;
}

public KeyPhraseResult(String id, TextDocumentStatistics textDocumentStatistics, List<String> keyPhrases) {
super(id, textDocumentStatistics);
this.keyPhrases = keyPhrases;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,19 @@
/**
* The LinkedEntityResult model.
*/
// TODO (shawn): Should be @Immutable, but will produce spotbug/checkstyle error
@Fluent
public final class LinkedEntityResult extends DocumentResult {
private final List<LinkedEntity> linkedEntities;

// TODO(shawn): not public modifier
public LinkedEntityResult(String id, Error error, boolean isError) {
super(id, error, isError);
linkedEntities = null;
}

// TODO(shawn): not public modifier

/**
* LinkedEntityResult model constructor
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ public String getText() {
* @param text the text value to set.
* @return the NamedEntity object itself.
*/
NamedEntity setText(String text) {
public NamedEntity setText(String text) {
this.text = text;
return this;
}
Expand All @@ -83,7 +83,7 @@ public String getType() {
* @param type the type value to set.
* @return the NamedEntity object itself.
*/
NamedEntity setType(String type) {
public NamedEntity setType(String type) {
this.type = type;
return this;
}
Expand All @@ -105,7 +105,7 @@ public String getSubtype() {
* @param subtype the subtype value to set.
* @return the NamedEntity object itself.
*/
NamedEntity setSubtype(String subtype) {
public NamedEntity setSubtype(String subtype) {
this.subtype = subtype;
return this;
}
Expand All @@ -127,7 +127,7 @@ public int getOffset() {
* @param offset the offset value to set.
* @return the NamedEntity object itself.
*/
NamedEntity setOffset(int offset) {
public NamedEntity setOffset(int offset) {
this.offset = offset;
return this;
}
Expand All @@ -149,7 +149,7 @@ public int getLength() {
* @param length the length value to set.
* @return the NamedEntity object itself.
*/
NamedEntity setLength(int length) {
public NamedEntity setLength(int length) {
this.length = length;
return this;
}
Expand All @@ -171,7 +171,7 @@ public double getScore() {
* @param score the score value to set.
* @return the NamedEntity object itself.
*/
NamedEntity setScore(double score) {
public NamedEntity setScore(double score) {
this.score = score;
return this;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,18 @@
/**
* The NamedEntityResult model.
*/
// TODO (shawn): Should be @Immutable, but will produce spotbug/checkstyle error
@Fluent
public final class NamedEntityResult extends DocumentResult {
private List<NamedEntity> namedEntities;
private final List<NamedEntity> namedEntities;

// TODO(shawn): not public modifier
public NamedEntityResult(String id, Error error, boolean isError) {
super(id, error, isError);
namedEntities = null;
}

// TODO(shawn): not public modifier
public NamedEntityResult(String id, TextDocumentStatistics textDocumentStatistics,
List<NamedEntity> namedEntities) {
super(id, textDocumentStatistics);
Expand All @@ -23,9 +31,4 @@ public NamedEntityResult(String id, TextDocumentStatistics textDocumentStatistic
public List<NamedEntity> getNamedEntities() {
return namedEntities;
}

NamedEntityResult setNamedEntities(List<NamedEntity> namedEntities) {
this.namedEntities = namedEntities;
return this;
}
}
Loading

0 comments on commit 56848e2

Please sign in to comment.