Use not \w+ to count words. It will separate numbers and words using Unicode as follows:
"The floating point number is 13.5812".scan /\w+/
=> ["The", "floating", "point", "number", "is", "13", "5812"]
The same is true for numbers with other type delimiters "12,000".
In Ruby 1.8, the expression w+worked with Unicode, this has changed. If your string contains Unicode characters, the word will also be split.
"Die Apfelbäume".scan /\w+/
=> ["Die", "Apfelb", "ume"]
There are two options.