What is the most frequent word?
Jelly, 25 bytes
ṣ⁶f€ØB;”-¤Œl©Qµ®ċЀĠṪịµẋE
Try it online! or verify all test cases.
Pyth - 23 30 bytes
There has to be a better way to include digits and hyphens, but I just want to fix this right now.
Kc@s+++GUTd\-rzZ)I!tJ.M/KZ{KhJ
Test Suite.
Octave, 115 94 bytes
[a,b,c]=unique(regexp(lower(input('')),'[A-z]*','match'));[~,~,d]=mode(c); try disp(a{d{:}})
Accounts for the case with no most frequent word by using try
. In this case it outputs nothing, and "takes a break" until you catch the exception.
Saved 21(!) bytes thanks to Luis Mendo's suggestion (using the third output from mode
to get the most common word).
The rules have changed quite a bit since I posted my original answer. I'll look into the regex later.