| Bytes | Lang | Time | Link |
|---|---|---|---|
| 052 | Ruby | 250427T191514Z | Jordan |
| 144 | Swift 6 | 240401T150857Z | macOSist |
| 152 | Google Sheets | 240331T213021Z | doubleun |
| 030 | 05AB1E | 240331T144534Z | Kevin Cr |
| 055 | Perl 5 p | 240401T164501Z | Xcali |
| 061 | JavaScript Node.js | 240330T102108Z | l4m2 |
| 097 | Regex | 240331T233532Z | arutonee |
| 026 | Jelly | 240331T093158Z | Jonathan |
| 066 | Retina 0.8.2 | 240329T215620Z | Neil |
| 031 | Uiua SBCS | 240330T110203Z | chunes |
| 036 | Charcoal | 240330T100303Z | Neil |
| 093 | JavaScript ES6 | 240330T025716Z | Justin M |
| 068 | JavaScript ES6 | 240329T233545Z | Arnauld |
Swift 6, 154 144 bytes
let l={($0+"").split{$0<"."}.map{"\($0.count%10)"}.joined()},f={{Float(l(""+$0[0])+"."+l({$0[1...].joined}($0)(" ")))!}(($0+"").split{$0=="."})}
This is, at its core, a similar idea to @Neil's Charcoal answer, just a lot more verbose.
Google Sheets, 152 bytes
=let(f,lambda(i,join(,sort(mod(len(split(index(split(substitute(substitute(A1,".","µ",1),".",","),"µ"),,i)," ,",1,1)),10)))),--(f(1)&iferror("."&f(2))))
Put the input in cell A1 and the formula in cell B1.

Ungolfed:
=let(
parts, split(substitute(substitute(A1, ".", "µ", 1), ".", ","), "µ"),
get_, lambda(i, join("", index(mod(len(split(index(parts,,i), " ,", 1, 1)), 10)))),
value(get_(1) & iferror("." & get_(2)))
)
05AB1E, 31 30 bytes
'.©1.;1¡ε1ú.γa}ιθεgθ]J®ý1/0Ü®Ü
Try it online or verify all test cases.
Explanation:
'. '# Push "."
© # Store it in variable `®` (without popping)
1.; # Replace the first "." in the (implicit) input with a 1
1¡ # Then split on that 1
ε # Map over both parts:
.γ } # Adjacent group by:
a # Is alphabetic?
ι # Uninterleave into two parts
θ # Only keep the last part with the words
ε # Map over the words:
g # Pop and push its length
θ # Pop and keep its last digit (aka mod-10)
] # Close the nested maps
J # Join each inner-most lists of digits together
®ý # Join both parts back together with a "."-delimiter
1/ # Divide it by 1 to remove trailing/leading 0s (which also
# adds a ".0" to any integers)
0Ü # Remove the trailing 0
®Ü # Remove the trailing "."
# (after which the result is output implicitly as result)
JavaScript (Node.js), 61 bytes
s=>+s.replace(/\w+|./g,a=>a+d<1?d=a:a>'?'?a.length%10:"",d=1)
-2B from tsh
You can assume the input is nonempty, and will consist of nothing but letters, commas, periods and spaces.
With letter filtered, all cases can be listed as follow:
| d | comma | period | space |
|---|---|---|---|
1 |
,1 |
.1 |
1 |
'.' |
,. |
.. |
. |
Only .1 is smaller than 1
Regex, 97 bytes (RegRep)
Not very short, but I thought it was funny.
[A-z]/_
\b_|0_/1
1_/2
2_/3
3_/4
4_/5
5_/6
6_/7
7_/8
8_/9
9_/0
^0(?=\d)|(?<=\..*)(\.|0$)|\.$|[, ]
Commented:
[A-z]/_ Replace all chars with _ to make counting shorter
\b_|0_/1 Replace all starting _ with 1
(\b|0)_ is longer lol
1_/2 1 -> 2
2_/3 2 -> 3
3_/4 3 -> 4, etc.
4_/5 .
5_/6 .
6_/7 .
7_/8 .
8_/9 .
9_/0 .
^0(?=\d)|(?<=\..*)(\.|0$)|\.$|[, ] removes...
| | | | | | extra chars
| | | | | trailing decimal
| | | | trailing 0...
| | | or any period...
| | but only after the first decimal point
| Leading 0s
Jelly, 26 bytes
”.ɓœṡnŒs$Œg§ḟ€0%⁵Ḍœrƭ€0j⁹t
A full program that accepts a string and prints the Rockstar poetic number literal.
Try it online! Or see the test-suite.
How?
”.ɓœṡnŒs$Œg§ḟ€0%⁵Ḍœrƭ€0j⁹t - Main Link: list of characters, Poem
”.ɓ - start a new chain f(Poem, Dot='.')
œṡ - split Poem at the first Dot
nŒs$ - not equal swapped-case? (vectorises)
Œg - group runs of equal elements
(only vectorises at depth 1)
§ - sums
ḟ€0 - filter zeros from each
%⁵ - mod ten
€ - for each:
ƭ - alternate between:
Ḍ - 1) convert from decimal
-> integer part as an integer
œr 0 - 2) trim zeros from right
-> decimal part as a digit list
j⁹ - join with a Dot
t - trim any Dots from either side
(removes a potential trailing dot)
- implicit, smashing print
Retina 0.8.2, 66 bytes
((\.)|.)*?(?=\w)(\w{10})*(\w*)
$2$.4
1>`\.
^0+\B|\.?0*(?<=\..*)$
Try it online! Link includes test cases. Explanation: Skips over enough non-letters to reach the next word, then skips over multiples of 10 letters, then counts any remaining letters, and captures any ., outputting the number of remaining letters and any captured .. Edit: Added an extra stage to remove insignificant zeros that don't change the value of the result. Edit: Improved the detection of .s and added an extra stage to remove .s after the first.
Uiua SBCS, 32 31 bytes
⋕▽⬚0⍜⊡¬⊗@.,≥@0.⍜⊜□(°⋕◿10∵◇⧻)⌵±.
-1 thanks to noodle man!
⋕▽⬚0⍜⊡¬⊗@.,≥@0.⍜⊜□(°⋕◿10∵◇⧻)⌵±.
. # duplicate
⌵± # mask of letters
⍜⊜□( ) # apply function to each contiguous mask group
∵◇⧻ # lengths
◿10 # modulo ten
°⋕ # unparse
. # duplicate
≥@0 # mask of digits
⊗@., # index of first period
⍜⊡¬ # negate at index
⬚0 # filling with zero if no period found
▽ # keep characters given mask
⋕ # parse to number, removing leading and trailing zeros
💎
Created with the help of Luminespire.
Charcoal, 36 bytes
≔⪪S.θII⪫E⟦§θ⁰⪫Φθκ ⟧⭆Φ⪪⪫⪪ι,¦ ¦ λ﹪Lλχ.
Try it online! Link is to verbose version of code. Explanation:
≔⪪S.θ
Split the input on all .s. (Charcoal doesn't have an easy way to split on just the first ..)
II⪫E⟦§θ⁰⪫Φθκ ⟧⭆Φ⪪⪫⪪ι,¦ ¦ λ﹪Lλχ.
For the first part and the join of any remaining parts on spaces, replace commas with spaces, then split on spaces, remove empty words, and replace the words with their lengths modulo 10. Join the pieces together with a ., then cast to float and back to string to remove irrelevant zeros.
JavaScript (ES6), 93 bytes
s=>s.split(/\W+/).map(w=>++a&&w.length%10,a=0).join``/10**(a-s.match(/(?<!\..*)\w+/g).length)
Try it online! Borrows the JS test runner from Arnauld's answer.
Getting back into CodeGolf after a long time, tried a different approach than Arnauld's beautiful regex magic.
JavaScript (ES6), 68 bytes
s=>+s.replace(/(?<!\..*)(\.)|\w+|(.)/g,(a,b,c)=>c?"":b||a.length%10)