Timeline for Count the words in a text and display them
Current License: CC BY-SA 3.0
13 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Jan 29, 2014 at 18:46 | history | edited | daniero | CC BY-SA 3.0 |
added 32 characters in body
|
Jan 29, 2014 at 12:09 | comment | added | daniero | @EduardFlorinescu Unless one uses a sorting function that randomizes the direction before it starts :D Ok, that's a stretch, but you never know... | |
Jan 29, 2014 at 12:02 | comment | added | Eduard Florinescu | @danier No, could not, not if sorted, I mentioned sorted but not descending, but if you see 2 first, and 1 second, and is sorted it cannot be random it descending. | |
Jan 29, 2014 at 11:55 | history | edited | daniero | CC BY-SA 3.0 |
added 1 characters in body
|
Jan 29, 2014 at 11:54 | comment | added | daniero | @EduardFlorinescu Yea, that was a sample! Could've been completely random that the output was like that ;) | |
Jan 29, 2014 at 11:52 | comment | added | Eduard Florinescu | If you see in the output sample it was sorted descended only that I forgot to specify it. | |
Jan 29, 2014 at 11:47 | comment | added | daniero |
@EduardFlorinescu Nah. reverse is way too verbose ;) Btw, it's not fair changing the question.
|
|
Jan 29, 2014 at 11:45 | history | edited | daniero | CC BY-SA 3.0 |
added 180 characters in body
|
Jan 29, 2014 at 10:59 | comment | added | Eduard Florinescu |
Shouldn't be sorted in reverse (a=gets.split(/[_\W]+/)).uniq.map{|w|[w,a.count(w)]}.sort_by(&:last).reverse.map{|x|p x}
|
|
Jan 29, 2014 at 9:43 | comment | added | daniero |
@Howard Thanks. \W excludes _ so that had to be fixed, but it still saved 2 characters (then I added 20 to fix the sorting that I had neglected).
|
|
Jan 29, 2014 at 9:37 | history | edited | daniero | CC BY-SA 3.0 |
Fixed blunder
|
Jan 29, 2014 at 8:51 | comment | added | Howard |
Maybe split(/\W+/) instead of scan (untested)?
|
|
Jan 29, 2014 at 8:49 | history | answered | daniero | CC BY-SA 3.0 |