@@ -63,7 +63,7 @@ public void analyzeCategoriesInTextReturnsExpectedResult() throws Exception {
6363
6464 @ Test
6565 public void analyzeCategoriesInFileReturnsExpectedResult () throws Exception {
66- String gcsFile = "gs://" + PROJECT_ID + "/natural- language/android_text .txt" ;
66+ String gcsFile = "gs://cloud-samples-data/ language/android .txt" ;
6767 Analyze .classifyFile (gcsFile );
6868 String got = bout .toString ();
6969 assertThat (got ).contains ("Computers & Electronics" );
@@ -81,10 +81,10 @@ public void analyzeEntities_withEntities_returnsLarryPage() throws Exception {
8181 }
8282
8383 @ Test
84- public void analyzeEntities_withEntitiesFile_containsGod () throws Exception {
85- Analyze .analyzeEntitiesFile ("gs://" + BUCKET + "/natural- language/gettysburg .txt" );
84+ public void analyzeEntities_withEntitiesFile_containsCalifornia () throws Exception {
85+ Analyze .analyzeEntitiesFile ("gs://cloud-samples-data/ language/entity .txt" );
8686 String got = bout .toString ();
87- assertThat (got ).contains ("God " );
87+ assertThat (got ).contains ("California " );
8888 }
8989
9090 @ Test
@@ -97,8 +97,8 @@ public void analyzeSentimentText_returnPositive() throws Exception {
9797
9898 @ Test
9999 public void analyzeSentimentFile_returnPositiveFile () throws Exception {
100- Sentiment sentiment = Analyze .analyzeSentimentFile ("gs://" + BUCKET + "/natural- language/"
101- + "sentiment/bladerunner-pos .txt" );
100+ Sentiment sentiment = Analyze .analyzeSentimentFile ("gs://cloud-samples-data/ language/"
101+ + "sentiment-positive .txt" );
102102 assertThat (sentiment .getMagnitude ()).isGreaterThan (0.0F );
103103 assertThat (sentiment .getScore ()).isGreaterThan (0.0F );
104104 }
@@ -113,21 +113,12 @@ public void analyzeSentimentText_returnNegative() throws Exception {
113113
114114 @ Test
115115 public void analyzeSentiment_returnNegative () throws Exception {
116- Sentiment sentiment = Analyze .analyzeSentimentFile ("gs://" + BUCKET + "/natural- language/"
117- + "sentiment/bladerunner-neg .txt" );
116+ Sentiment sentiment = Analyze .analyzeSentimentFile ("gs://cloud-samples-data/ language/"
117+ + "sentiment-negative .txt" );
118118 assertThat (sentiment .getMagnitude ()).isGreaterThan (0.0F );
119119 assertThat (sentiment .getScore ()).isLessThan (0.0F );
120120 }
121121
122- @ Test
123- public void analyzeSentiment_returnNeutralFile () throws Exception {
124- Sentiment sentiment = Analyze .analyzeSentimentFile ("gs://" + BUCKET + "/natural-language/"
125- + "sentiment/bladerunner-neutral.txt" );
126- assertThat (sentiment .getMagnitude ()).isGreaterThan (1.0F );
127- // TODO sentiment score for netural sample appears to be zero now.
128- // assertThat((double)sentiment.getScore()).isGreaterThan(0.0);
129- }
130-
131122 @ Test
132123 public void analyzeSyntax_partOfSpeech () throws Exception {
133124 List <Token > tokens = Analyze
@@ -142,16 +133,13 @@ public void analyzeSyntax_partOfSpeech() throws Exception {
142133
143134 @ Test
144135 public void analyzeSyntax_partOfSpeechFile () throws Exception {
145- List <Token > token = Analyze .analyzeSyntaxFile ("gs://" + BUCKET + "/natural- language/"
146- + "sentiment/bladerunner-neutral .txt" );
136+ List <Token > token = Analyze .analyzeSyntaxFile ("gs://cloud-samples-data/ language/"
137+ + "syntax-sentence .txt" );
147138
148139 List <Tag > got = token .stream ().map (e -> e .getPartOfSpeech ().getTag ())
149140 .collect (Collectors .toList ());
150-
151- assertThat (got ).containsExactly (Tag .PRON , Tag .CONJ , Tag .VERB , Tag .CONJ , Tag .VERB ,
152- Tag .DET , Tag .NOUN , Tag .PUNCT , Tag .NOUN , Tag .VERB , Tag .ADJ , Tag .PUNCT , Tag .CONJ ,
153- Tag .ADV , Tag .PRON , Tag .VERB , Tag .VERB , Tag .VERB , Tag .ADJ , Tag .PUNCT , Tag .DET ,
154- Tag .NOUN , Tag .VERB , Tag .ADV , Tag .ADJ , Tag .PUNCT ).inOrder ();
141+ assertThat (got ).containsExactly (Tag .DET , Tag .VERB , Tag .DET , Tag .ADJ , Tag .NOUN ,
142+ Tag .PUNCT ).inOrder ();
155143 }
156144
157145 @ Test
@@ -171,9 +159,9 @@ public void analyzeEntitySentimentTextEncodedReturnsExpectedResult() throws Exce
171159
172160 @ Test
173161 public void analyzeEntitySentimenFileReturnsExpectedResult () throws Exception {
174- Analyze .entitySentimentFile ("gs://" + BUCKET + "/natural- language/gettysburg .txt" );
162+ Analyze .entitySentimentFile ("gs://cloud-samples-data/ language/president .txt" );
175163 String got = bout .toString ();
176- assertThat (got ).contains ("God " );
164+ assertThat (got ).contains ("Kennedy " );
177165 }
178166
179167}
0 commit comments