File tree Expand file tree Collapse file tree 1 file changed +11
-0
lines changed
language/analysis/src/test/java/com/google/cloud/language/samples Expand file tree Collapse file tree 1 file changed +11
-0
lines changed Original file line number Diff line number Diff line change 2020
2121import com .google .cloud .language .spi .v1beta2 .LanguageServiceClient ;
2222import com .google .cloud .language .v1beta2 .Entity ;
23+ import com .google .cloud .language .v1beta2 .EntityMention ;
2324import com .google .cloud .language .v1beta2 .Sentiment ;
2425
2526import org .junit .Before ;
2829import org .junit .runners .JUnit4 ;
2930
3031import java .util .List ;
32+ import java .util .Map ;
3133import java .util .stream .Collectors ;
3234
3335/**
@@ -66,6 +68,15 @@ public class AnalyzeBetaIT {
6668 assertThat (got ).named ("entity names" ).contains ("Seattle" );
6769 }
6870
71+ @ Test public void analyzeSyntax_entitySentimentTextEncoded () throws Exception {
72+ List <Entity > entities = analyzeApp .entitySentimentText ("foo→bar" );
73+
74+ List <EntityMention > mentions = entities .listIterator ().next ().getMentionsList ();
75+
76+ // Assert
77+ assertThat (mentions .get (0 ).getText ().getBeginOffset () == 4 );
78+ }
79+
6980 @ Test public void analyzeSyntax_entitySentimentFile () throws Exception {
7081 List <Entity > entities =
7182 analyzeApp .entitySentimentFile ("gs://" + BUCKET + "/natural-language/gettysburg.txt" );
You can’t perform that action at this time.
0 commit comments