What is a from property level script?
Yes you can create an array of words and a document level function. Spliting words and testing words is farily complex as you have to split the text by all the diffferent white space characters and then adjust for the case of the text.
This seems a lot for free.
Have you searched the internet for scripts to count words, convert text to Title Case?
I developed a tool that does just that, but was warned by an admin against linking to paid products, so I won't.