how to turn a Persian (Farsi) paragraph into its list of words in Javascript
问题 I am trying to make an object out of a paragraph that shows words with their frequencies. var pattern = /\w+/g, //the farsi paragraph string = "من امروز در مورد مهر خروج مشمولین اطلاعات جدیدی از سفارت ایران در مالزی گرفتم", matchedWords = string.match( pattern ); /* The Array.prototype.reduce method assists us in producing a single value from an array. In this case, we're going to use it to output an object with results. */ var counts = matchedWords.reduce(function ( stats, word ) { /* `stats