Solved Kate Word Count

Solved issue

rdfrkian

Member
Joined
Dec 1, 2023
Messages
26
Reaction score
31
Credits
225
I've been doing some writing lately, and I'm using KATE to do the html.
Now the last time I used it, I thought it had natively supported a feature called WordCount, which would count the number of words in the document for you.
Is that no longer available or is there something I missed? (I think it used to be under View --> word count.)

Red

kubuntu 22.04
KATE 21.12.3
 


You can add a word count script

 
I don't know about Kate, but some simple text editors, like xed and gedit, have built-in word count features in a Tools category called "Documents Statistics."

Another simple way is using the Linux "word count" command: wc

I'm not sure how any of the editors or wc would classify html tags, like <h1>.... is that a word? That you want to count? Both of the above text editors report the same number of words for me on a test.html file, but the wc command reports fewer words. But whatever works for you... good luck!
 
Last edited:
Something like html2text <file_name>.html | wc -w might do the trick.
 
Interesting! Not only does that show fewer words... it also shows fewer lines on my small test file... using " | wc " without the " -w " option to see the full output, not just the word count. :oops:
 
Interesting! Not only does that show fewer words... it also shows fewer lines on my small test file... using " | wc " without the " -w " option to see the full output, not just the word count. :oops:

I didn't test it but fewer words makes sense - as may fewer lines, depending on the file you're using.

After all, <head> would likely be a line by itself. It really depends how you wrote it.
 
To do a "rough" comparison for word counts on a file using html2text, and a screen scrape of the text by accessing it in a browser, I used the file: /usr/share/synaptic/html/apa.html.

The screen scrape of the text of the .html file was pasted into the file: htmlword.txt, using the text editor vim. The the following commands were run:

Code:
[tom@min ~]$ wc -w htmlword.txt
507 htmlword
[tom@min ~]$ html2text /usr/share/synaptic/html/apa.html | wc -w
511
Close enough for jazz :) . YMMV.
 
thanks, y'all. I'm going to try to use the script first mentioned. I've never actually manually added a script to Kate before, so I've a learning curve lol..

As of now, I just display the page as an html page, copy the text and dump it into LibreWriter to get a word count.
That won't be practical for novels, but you know, works for now. thanks again. <3
 

Staff online


Latest posts

Top