回答編集履歴

5

修正

2017/06/21 08:39

投稿

退会済みユーザー
test CHANGED
@@ -232,7 +232,7 @@
232
232
 
233
233
 
234
234
 
235
- column = open(ARGV[0], &:read).gsub(/,|\./, '').split(' ')
235
+ column = open(ARGV[0], &:read).delete(',.').split(' ')
236
236
 
237
237
  puts column
238
238
 

4

修正

2017/06/21 08:39

投稿

退会済みユーザー
test CHANGED
@@ -224,6 +224,24 @@
224
224
 
225
225
  ```
226
226
 
227
+ プログラム全体
228
+
229
+ ```Ruby
230
+
231
+ # encoding: utf-8
232
+
233
+
234
+
235
+ column = open(ARGV[0], &:read).gsub(/,|\./, '').split(' ')
236
+
237
+ puts column
238
+
239
+ puts "I:#{column.count('I')}"
240
+
241
+
242
+
243
+ ```
244
+
227
245
 
228
246
 
229
247
  対象になっているページ

3

修正

2017/06/21 08:31

投稿

退会済みユーザー
test CHANGED
@@ -158,6 +158,74 @@
158
158
 
159
159
 
160
160
 
161
+ # 追記
162
+
163
+ ```Ruby
164
+
165
+ text =<<-EOS
166
+
167
+ 0:11
168
+
169
+ Growing up, I didn't always understand why my parents made me follow the rules that they did. Like, why did I really have to mow the lawn? Why was homework really that important? Why couldn't I put jelly beans in my oatmeal?
170
+
171
+ 0:26
172
+
173
+ My childhood was abound with questions like this. Normal things about being a kid and realizing that sometimes, it was best to listen to my parents even when I didn't exactly understand why. And it's not that they didn't want me to think critically. Their parenting always sought to reconcile the tension between having my siblings and I understand the realities of the world, while ensuring that we never accepted the status quo as inevitable.
174
+
175
+ 0:50
176
+
177
+ I came to realize that this, in and of itself, was a very purposeful form of education. One of my favorite educators, Brazilian author and scholar Paulo Freire, speaks quite explicitly about the need for education to be used as a tool for critical awakening and shared humanity. In his most famous book, "Pedagogy of the Oppressed," he states, "No one can be authentically human while he prevents others from being so."
178
+
179
+ 1:19
180
+
181
+ I've been thinking a lot about this lately, this idea of humanity, and specifically, who in this world is afforded the privilege of being perceived as fully human. Over the course of the past several months, the world has watched as unarmed black men, and women, have had their lives taken at the hands of police and vigilante. These events and all that has transpired after them have brought me back to my own childhood and the decisions that my parents made about raising a black boy in America that growing up, I didn't always understand in the way that I do now.
182
+
183
+ 1:52
184
+
185
+ I think of how hard it must have been, how profoundly unfair it must have felt for them to feel like they had to strip away parts of my childhood just so that I could come home at night.
186
+
187
+ 2:04
188
+
189
+ For example, I think of how one night, when I was around 12 years old, on an overnight field trip to another city, my friends and I bought Super Soakers and turned the hotel parking lot into our own water-filled battle zone. We hid behind cars, running through the darkness that lay between the streetlights, boundless laughter ubiquitous across the pavement. But within 10 minutes, my father came outside, grabbed me by my forearm and led me into our room with an unfamiliar grip. Before I could say anything, tell him how foolish he had made me look in front of my friends, he derided me for being so naive. Looked me in the eye, fear consuming his face, and said, "Son, I'm sorry, but you can't act the same as your white friends. You can't pretend to shoot guns. You can't run around in the dark. You can't hide behind anything other than your own teeth."
190
+
191
+ 2:59
192
+
193
+ I know now how scared he must have been, how easily I could have fallen into the empty of the night, that some man would mistake this water for a good reason to wash all of this away.
194
+
195
+ 3:12
196
+
197
+ These are the sorts of messages I've been inundated with my entire life: Always keep your hands where they can see them, don't move too quickly, take off your hood when the sun goes down. My parents raised me and my siblings in an armor of advice, an ocean of alarm bells so someone wouldn't steal the breath from our lungs, so that they wouldn't make a memory of this skin. So that we could be kids, not casket or concrete. And it's not because they thought it would make us better than anyone else it's simply because they wanted to keep us alive.
198
+
199
+ 3:38
200
+
201
+ All of my black friends were raised with the same message, the talk, given to us when we became old enough to be mistaken for a nail ready to be hammered to the ground, when people made our melanin synonymous with something to be feared.
202
+
203
+ 3:51
204
+
205
+ But what does it do to a child to grow up knowing that you cannot simply be a child? That the whims of adolescence are too dangerous for your breath, that you cannot simply be curious, that you are not afforded the luxury of making a mistake, that someone's implicit bias might be the reason you don't wake up in the morning.
206
+
207
+ 4:09
208
+
209
+ But this cannot be what defines us. Because we have parents who raised us to understand that our bodies weren't meant for the backside of a bullet, but for flying kites and jumping rope, and laughing until our stomachs burst. We had teachers who taught us how to raise our hands in class, and not just to signal surrender, and that the only thing we should give up is the idea that we aren't worthy of this world. So when we say that black lives matter, it's not because others don't, it's simply because we must affirm that we are worthy of existing without fear, when so many things tell us we are not. I want to live in a world where my son will not be presumed guilty the moment he is born, where a toy in his hand isn't mistaken for anything other than a toy.
210
+
211
+ 4:46
212
+
213
+ And I refuse to accept that we can't build this world into something new, some place where a child's name doesn't have to be written on a t-shirt, or a tombstone, where the value of someone's life isn't determined by anything other than the fact that they had lungs, a place where every single one of us can breathe.
214
+
215
+ 5:03
216
+
217
+ Thank you.
218
+
219
+ EOS
220
+
221
+
222
+
223
+ p text.split(' ').count('I') # => 18
224
+
225
+ ```
226
+
227
+
228
+
161
229
  対象になっているページ
162
230
 
163
231
  [アメリカで黒人の息子を育てる方法](https://www.ted.com/talks/clint_smith_how_to_raise_a_black_son_in_america/transcript?language=en)

2

修正

2017/06/21 08:24

投稿

退会済みユーザー
test CHANGED
@@ -10,7 +10,7 @@
10
10
 
11
11
 
12
12
 
13
- text1 = text.gsub(/\,|\./, '')
13
+ text1 = text.gsub(/\,|\./, "")
14
14
 
15
15
  column = text1.split(/ /)
16
16
 

1

修正

2017/06/21 08:09

投稿

退会済みユーザー
test CHANGED
@@ -2,13 +2,9 @@
2
2
 
3
3
  text =<<-EOS
4
4
 
5
- 4:46And I refuse to accept that we can't build this world into something new, some place a
5
+ 4:46
6
6
 
7
- child's name doesn't have to be written on a t-shirt, or a tombstone, where the value of
8
-
9
- somenone's life isn't determined by anything other than the fact that they had lugs, a place where
10
-
11
- every single one of us can breath.
7
+ And I refuse to accept that we can't build this world into something new, some place where a child's name doesn't have to be written on a t-shirt, or a tombstone, where the value of someone's life isn't determined by anything other than the fact that they had lungs, a place where every single one of us can breathe.
12
8
 
13
9
  EOS
14
10
 
@@ -24,13 +20,17 @@
24
20
 
25
21
  print "I:", column.select { |item1| item1 == "I" }.size, "\n"
26
22
 
23
+
24
+
27
25
  ```
28
26
 
29
27
  実行結果例
30
28
 
31
29
  ```
32
30
 
33
- 4:46And
31
+ 4:46
32
+
33
+ And
34
34
 
35
35
  I
36
36
 
@@ -61,6 +61,8 @@
61
61
  some
62
62
 
63
63
  place
64
+
65
+ where
64
66
 
65
67
  a
66
68
 
@@ -98,7 +100,7 @@
98
100
 
99
101
  of
100
102
 
101
- somenone's
103
+ someone's
102
104
 
103
105
  life
104
106
 
@@ -124,7 +126,7 @@
124
126
 
125
127
  had
126
128
 
127
- lugs
129
+ lungs
128
130
 
129
131
  a
130
132
 
@@ -144,7 +146,7 @@
144
146
 
145
147
  can
146
148
 
147
- breath
149
+ breathe
148
150
 
149
151
  I:1
150
152
 
@@ -153,3 +155,9 @@
153
155
  試してみました。スペースで分割できています。
154
156
 
155
157
  質問者様のテキストファイルに原因があるような気がします。
158
+
159
+
160
+
161
+ 対象になっているページ
162
+
163
+ [アメリカで黒人の息子を育てる方法](https://www.ted.com/talks/clint_smith_how_to_raise_a_black_son_in_america/transcript?language=en)