The nuance between property word count and count words command of plain text

Does it seem that the “word count” property and “count words” command on the plain text of a document (markdown, rtf, pdf) is different? Moreover, tests on a limited sample show that (1) the “word count” property is consistently larger than the count word for pdf files and (2) the “word count” property is consistently smaller than the count word for plain text and markdown files and (3) only in the case of rtf the “word count” property is the same as the count word for pdf files.

For example, I select a pdf file and get the following results

tell application id "DNtp"
	set {theDoc} to item 1 of {selection}
	set theText to plain text of theDoc
	set theWordCount to word count of theDoc
	-- return 8698
	set theCountWord to count words of theText
	-- return 8527
end tell

This is no big deal coz it is easy to work around on this issue, just curious.

Thank you very much in advance!

They’re indeed different. word count is a property of the record and identical to the values displayed in DEVONthink and based on the search index. count words of theText is just AppleScript’s standard text and word processing. Retrieving the word count is therefore also much faster.

Thanks for the info.