That works, thank you. I have been looking for a way to do that ... and with a minor modification it can be used as a Universal Action:
on run
set theWordCount to count words of ("{query}" as string)
display dialog (theWordCount & " words in the selected text." as string)
end run