@@ -172,6 +172,58 @@ describe( 'its functions for .out()', function () {
172
172
expect ( doc . out ( its . readabilityStats ) ) . to . deep . equal ( rs ) ;
173
173
} ) ;
174
174
175
+ it ( 'its.sentenceWiseImprotance' , function ( ) {
176
+ const text = `Children living in Japan’s hottest city will be given specially designed umbrellas to protect them
177
+ from the heat, after a summer that saw record-breaking temperatures in many parts of the country.Local authorities
178
+ in Kumagaya in Saitama prefecture have devised an umbrella that keeps out the rain and doubles as a parasol,
179
+ the Mainichi Shimbun reported. The umbrellas, which bear the city’s logo and weigh just 336 grams, will be distributed
180
+ to 9,000 primary schoolchildren next week, the newspaper said. Kumagaya, a city of about 195,000 located 60km north of
181
+ Tokyo, regularly records the highest temperatures in Japan partly as a result of warm downslope winds created by the
182
+ Foehn Effect. The city’s government has for the past two years advised younger children to shield themselves from the
183
+ sun with regular umbrellas on their way to and from school to prevent heatstroke, but some questioned their ability to
184
+ block out sunlight. Alarmed by a rise in the number of days when the mercury rises to at least 35C, the city decided
185
+ to hand out the yellow fibreglass umbrellas, including to children who live in Kumagaya but attend schools outside the
186
+ city, the Mainichi said. The heat-busting brollies will also force children to maintain a reasonable distance from
187
+ each other, eliminating the need for them to wear masks to prevent the spread of the coronavirus, it added. The measure
188
+ has come a little late in the day, however. Japan battled its worst heatwave since records began in 1875 in late June,
189
+ after a premature end to the rainy season. The city of Isesaki, north of Tokyo, registered the country’s highest-ever
190
+ temperature for that month, at 40.2C, beating the previous June record of 39.8C set in 2011. Tokyo experienced several
191
+ consecutive days of 35C-plus heat, prompting the government to warn people to save energy or face power cuts, while
192
+ Kumagaya and five other locations marked highs above 40C on 1 July. Kumagaya’s reputation for furnace-like temperatures
193
+ was sealed in July 2018, when it battled an all-time high temperature of 41.1C – an unenviable record it shares with the
194
+ city of Hamamatsu in central Japan. On Friday, the maximum temperature for Kumagaya was a far more comfortable 26C,
195
+ according to the meteorological agency, although it forecast a rerun to the low 30s next week. Officials had hoped to
196
+ distribute the umbrellas before the school summer holidays began were delayed by the Covid-19 pandemic. Global heating
197
+ has prompted Japan’s government to take extra measures and issue a slew of advice on how to prevent heatstroke.
198
+ Almost all classrooms in public primary and middle schools now have air conditioners, according to the Asahi Shimbun,
199
+ while the education ministry last year urged teachers to instruct children to wear cool clothing and hats, and to
200
+ keep hydrated when they travel to and from school. The pandemic has frustrated attempts to keep children cool at school,
201
+ however, with teachers reporting that many are reluctant to remove their masks, even with encouragement from staff.` ;
202
+
203
+ const rank = [
204
+ { 'importance' : 0.9667 , 'index' : 0 } ,
205
+ { 'importance' : 0.2667 , 'index' : 1 } ,
206
+ { 'importance' : 0.1333 , 'index' : 2 } ,
207
+ { 'importance' : 0.7 , 'index' : 3 } ,
208
+ { 'importance' : 0.5 , 'index' : 4 } ,
209
+ { 'importance' : 1 , 'index' : 5 } ,
210
+ { 'importance' : 1 , 'index' : 6 } ,
211
+ { 'importance' : 0 , 'index' : 7 } ,
212
+ { 'importance' : 0.3667 , 'index' : 8 } ,
213
+ { 'importance' : 0.6333 , 'index' : 9 } ,
214
+ { 'importance' : 0.9667 , 'index' : 10 } ,
215
+ { 'importance' : 0.4333 , 'index' : 11 } ,
216
+ { 'importance' : 0.8667 , 'index' : 12 } ,
217
+ { 'importance' : 0.3667 , 'index' : 13 } ,
218
+ { 'importance' : 0.1 , 'index' : 14 } ,
219
+ { 'importance' : 0.8333 , 'index' : 15 } ,
220
+ { 'importance' : 0.3 , 'index' : 16 }
221
+ ] ;
222
+
223
+ expect ( nlp . readDoc ( text ) . out ( its . sentenceWiseImprotance ) ) . to . deep . equal ( rank ) ;
224
+ expect ( nlp . readDoc ( 'text' ) . out ( its . sentenceWiseImprotance ) ) . to . deep . equal ( [ ] ) ;
225
+ } ) ;
226
+
175
227
it ( 'selected entity with its.detail, its.span as.?' , function ( ) {
176
228
const s = 'Conut downn starts from ten, nine, eight...' ;
177
229
const se = nlp . readDoc ( s ) . entities ( ) . filter ( ( e ) => ( e . out ( its . type ) === 'CARDINAL' ) ) ;
0 commit comments