hyphen-reader / hyphen

Repository for Hyphen Reader
http://hyphenreader.com
18 stars 2 forks source link

Word Count #49

Open ijudy opened 8 years ago

ijudy commented 8 years ago

When I pick up a book I can immediately gauge its heft. An electronic book, on the other hand, only shows me its cover. Could Hyphen count and display the words in a book, and display it somewhere, possibly the VIEW INFO section? Thanks.

nando-sandiego commented 7 years ago

Here is a regex word count function I picked up from the internet. The app author might find this useful if the app can handle regex.

\w+(?![^<>]>)(?!.<body[^>]*>)

It only counts words that occur within the epub body. For the app author this means only words occurring with and in-between >__<. Punctuation is not counted. It is not perfect (e.g. counts a.m. as two words) but it is good enough to give you a good idea of the time you might invest in reading a zero-weight epub.