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 20
20
21
21
import com .google .cloud .language .spi .v1beta2 .LanguageServiceClient ;
22
22
import com .google .cloud .language .v1beta2 .Entity ;
23
+ import com .google .cloud .language .v1beta2 .EntityMention ;
23
24
import com .google .cloud .language .v1beta2 .Sentiment ;
24
25
25
26
import org .junit .Before ;
28
29
import org .junit .runners .JUnit4 ;
29
30
30
31
import java .util .List ;
32
+ import java .util .Map ;
31
33
import java .util .stream .Collectors ;
32
34
33
35
/**
@@ -66,6 +68,15 @@ public class AnalyzeBetaIT {
66
68
assertThat (got ).named ("entity names" ).contains ("Seattle" );
67
69
}
68
70
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
+
69
80
@ Test public void analyzeSyntax_entitySentimentFile () throws Exception {
70
81
List <Entity > entities =
71
82
analyzeApp .entitySentimentFile ("gs://" + BUCKET + "/natural-language/gettysburg.txt" );
You can’t perform that action at this time.
0 commit comments