Skip to content

Commit

Permalink
Merge pull request #667 from GoogleCloudPlatform/language-encoding-test
Browse files Browse the repository at this point in the history
Adds test for encoded characters.
  • Loading branch information
gguuss authored May 18, 2017
2 parents 9dd1fbe + 8391dd6 commit b09f9fd
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ public static void printSyntax(PrintStream out, List<Token> tokens) {
out.printf("\tBeginOffset: %d\n", token.getText().getBeginOffset());
out.printf("Lemma: %s\n", token.getLemma());
out.printf("PartOfSpeechTag: %s\n", token.getPartOfSpeech().getTag());
out.printf("\tAspect: %s\n",token.getPartOfSpeech().getAspect());
out.printf("\tAspect: %s\n", token.getPartOfSpeech().getAspect());
out.printf("\tCase: %s\n", token.getPartOfSpeech().getCase());
out.printf("\tForm: %s\n", token.getPartOfSpeech().getForm());
out.printf("\tGender: %s\n",token.getPartOfSpeech().getGender());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@

import com.google.cloud.language.spi.v1beta2.LanguageServiceClient;
import com.google.cloud.language.v1beta2.Entity;
import com.google.cloud.language.v1beta2.EntityMention;
import com.google.cloud.language.v1beta2.Sentiment;

import org.junit.Before;
Expand Down Expand Up @@ -66,6 +67,15 @@ public class AnalyzeBetaIT {
assertThat(got).named("entity names").contains("Seattle");
}

@Test public void analyzeSyntax_entitySentimentTextEncoded() throws Exception {
List<Entity> entities = analyzeApp.entitySentimentText("foo→bar");

List<EntityMention> mentions = entities.listIterator().next().getMentionsList();

// Assert
assertThat(mentions.get(0).getText().getBeginOffset() == 4);
}

@Test public void analyzeSyntax_entitySentimentFile() throws Exception {
List<Entity> entities =
analyzeApp.entitySentimentFile("gs://" + BUCKET + "/natural-language/gettysburg.txt");
Expand Down

0 comments on commit b09f9fd

Please sign in to comment.