\documentclass{article}
\usepackage{color}
\usepackage{lipsum}
\usepackage{ptext}
\usepackage{xepersian}
\settextfont{Yas}
\makeatletter
\newcount\WordCount
\newcount\My@Alphabets
\newXeTeXintercharclass\MyAlphabets
\newXeTeXintercharclass\MyComma
\XeTeXcharclass`\،\MyComma
\XeTeXcharclass`\,\MyComma
\My@Alphabets=`\آ \loop \XeTeXcharclass \My@Alphabets=\MyAlphabets \ifnum\My@Alphabets<`\ی \advance\My@Alphabets \@ne \repeat
\My@Alphabets=`\A \loop \XeTeXcharclass \My@Alphabets=\MyAlphabets \ifnum\My@Alphabets<`\Z \advance\My@Alphabets \@ne \repeat
\My@Alphabets=`\a \loop \XeTeXcharclass \My@Alphabets=\MyAlphabets \ifnum\My@Alphabets<`\z \advance\My@Alphabets \@ne \repeat
\XeTeXinterchartoks \MyAlphabets 4095 = {\PrintWordCount}
\XeTeXinterchartoks \MyAlphabets \MyComma = {\PrintWordCount}
\XeTeXinterchartoks \MyAlphabets \bidi@dot@charclass = {\PrintWordCount}
\newcommand*{\PrintWordCount}{\raise.8\baselineskip\llap{\tiny\global\advance\WordCount\@ne\textcolor{red}{\the\WordCount}}}
\makeatother

\begin{document}
\ptext
\begin{latin}
\lipsum
\end{latin}
\end{document}