Total Word Count?

246 views
Skip to first unread message

LG

unread,
Oct 4, 2020, 8:58:50 PM10/4/20
to TiddlyWiki
I copied all of my writing into one TW file. Is there a way to get a total word count? There are 823 tiddlers. 

Eric Shulman

unread,
Oct 4, 2020, 10:39:51 PM10/4/20
to TiddlyWiki
On Sunday, October 4, 2020 at 5:58:50 PM UTC-7, LG wrote:
I copied all of my writing into one TW file. Is there a way to get a total word count? There are 823 tiddlers. 

{{{ [all[tiddlers]!is[system]get[text]splitregexp[\s+]count[]] }}}

* {{{ [...] }}} encloses an "inline filter" (aka, "filter transclusion")
* all[tiddlers] includes regular and system tiddlers
* !is[system] eliminates the system tiddlers (those with the $:/ prefix)
* get[text] fetches the text content of each tiddler
* splitregexp[\s+] splits the text at each sequence of one or more "whitespace" characters, including space, tab, form feed, line feed, and other Unicode spaces.
* count[] returns the number of resulting items

enjoy,
-e

Joshua Fontany

unread,
Oct 5, 2020, 6:58:55 PM10/5/20
to TiddlyWiki
Excellent response, and so close to mine I will let it stand. Good use of {{{ ... }}} "transcluded filter" notation.

You could also type that filter into the "Filter" tab of $:/AdvancedSearch.

Best,
Joshua F

LG

unread,
Oct 5, 2020, 8:08:56 PM10/5/20
to TiddlyWiki
Thank you, Eric and Joshua!

I'm not getting a response back out unfortunately. Instead I get a link to a zero. I copied it into a new Tiddler to see what'd happen and I got zero. I then put it into the Filter tab of  $:/AdvancedSearch and received this message: 

3 matches

Joshua Fontany

unread,
Oct 5, 2020, 9:49:43 PM10/5/20
to TiddlyWiki
In the Filter tab of $:/AdvancedSearch, use only the inner "filter run":


[all[tiddlers]!is[system]get[text]splitregexp[\s+]count[]]


(Tested and working on tiddlywiki.com.)

Best,
Joshua F

Amanda L. Goodman

unread,
Oct 6, 2020, 6:07:03 PM10/6/20
to tiddl...@googlegroups.com
Joshua, thank you for working with me on this. I tried it on Tiddlywiki.com and saw that it worked perfectly. I also quickly tested it in a new file with just one tiddler with a few words thrown in. It worked again. 

This time in my desired file (in the Advanced Search), I got a plain zero. The only customization on this Tiddler is that I have it set so that a new tiddler has a custom title of "New Story." Do you think that may have an affect? I originally created this TiddlyWiki a couple years ago, so I have no idea offhand where I made that change to see if that is the problem.

--
You received this message because you are subscribed to a topic in the Google Groups "TiddlyWiki" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/tiddlywiki/6acL1HS8Zws/unsubscribe.
To unsubscribe from this group and all its topics, send an email to tiddlywiki+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/tiddlywiki/300ef646-13b5-404e-adeb-d14b8a65604an%40googlegroups.com.

Eric Shulman

unread,
Oct 6, 2020, 6:22:11 PM10/6/20
to TiddlyWiki
On Tuesday, October 6, 2020 at 3:07:03 PM UTC-7, LG wrote:
...I originally created this TiddlyWiki a couple years ago...

What version of TiddlyWiki is that file?  (Look in $:/ControlPanel, Info, Basics) 

There's been lots of improvements to filter expressions.  In particular, "splitregexp[]" was only added in 5.1.20.  If a filter expression does not use a recognized keyword, it is treated as a reference to a tiddler field with that name.  Thus, if your TW version is older than 5.1.20, "splitregexp[\s+]" would be seen as an attempt to look for a field named "splitregexp" with a matching literal value of "\s+", which obviously won't exist, resulting in a count[] of 0.

-e

Amanda L. Goodman

unread,
Oct 8, 2020, 9:24:20 PM10/8/20
to tiddl...@googlegroups.com
Dear Eric,

That did the trick! (The answer turned out to be 659,687 words)

Thank you and Joshua both for your help.

--
You received this message because you are subscribed to a topic in the Google Groups "TiddlyWiki" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/tiddlywiki/6acL1HS8Zws/unsubscribe.
To unsubscribe from this group and all its topics, send an email to tiddlywiki+...@googlegroups.com.

TW Tones

unread,
Oct 9, 2020, 12:42:17 AM10/9/20
to TiddlyWiki
Lg,

I was working on a small project to create subtitle tags, basically using the tag $:/tags/subtitle you can place items in the tiddler subtitle.

This text size measure sounded like an ideal candidate.
  • Using the suggestions in this thread for words and characters
  • I also added two value tests
    • Are the number of characters below 1300 they fit in a linked in post
    • Are the number of characters above 1300 and under 125,000 they fit in a linked in Article.
If you install this JSON then open $:/PSaT/subtitle-tags/text-size and you can see how I did it and adjust to you needs.

Note It modified the core tiddler 

$:/core/ui/ViewTemplate/subtitle


Any feedback will help me publish it.

Regards
Tony
subtitle-tags.json

Amanda L. Goodman

unread,
Oct 9, 2020, 10:31:16 PM10/9/20
to tiddl...@googlegroups.com
Hey, Tony! 

I'm happy to help. I'll admit that I'm not sure what I'm looking for here, so I'd appreciate you spelling it out for me. 

I did the import and read the info off the usage tiddler. I then created a "Subtitle Test" tiddler and wrote: Hey. This resulted in it appearing right next to the date (under the title) with no space between the time and Hey. When I added "  Hey" (with no quotation marks), the expected and hoped for space appeared between the date and Hey.

9th October 2020 at 10:21pm  Hey.

I'm not sure what this part means in what I should be looking for:
  • Are the number of characters below 1300 they fit in a linked in post
  • Are the number of characters above 1300 and under 125,000 they fit in a linked in Article.
How I'm interpreting it is that if the subtitle text is below a certain amount, it'll fit in the subtitle area. So I adjusted and set the below level as 10. After I put in ~60 dummy text and checked again, all ~60 words still showed up in the subtitle field. I'm certain that I'm not understanding your intentions. 

Best, 

LG

--
You received this message because you are subscribed to a topic in the Google Groups "TiddlyWiki" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/tiddlywiki/6acL1HS8Zws/unsubscribe.
To unsubscribe from this group and all its topics, send an email to tiddlywiki+...@googlegroups.com.

TW Tones

unread,
Oct 10, 2020, 2:12:48 AM10/10/20
to TiddlyWiki
LG,

Simply put this provides a way to place things into the subtitle of all tiddlers.

One of those things is a display of characters and words found in the text field of tiddlers found defined in 

$:/PSaT/subtitle-tags/text-size


It has the added feature that it has two numbers which it uses to indicate if the character counts exceed one of two values.
In this case the two thresholds relate to posts or articles in the LinkedIn.com network. another example 10,000+ words I hear is what some essays must be for universities etc...

Your original enquiry for was the whole of the wiki? This is the same but for each tiddler. Either remove the logic or add your own thresholds.
By the way it works in edit as well :)

Going forward the subtitle-tags.json what else can you do with it?
Perhaps it could be designed to count words after rendering, to count the works in the finished tiddler after transclusions etc..


Has this answered your Questions?

Tones

On Saturday, 10 October 2020 13:31:16 UTC+11, LG wrote:
Hey, Tony! 

I'm happy to help. I'll admit that I'm not sure what I'm looking for here, so I'd appreciate you spelling it out for me. 

I did the import and read the info off the usage tiddler. I then created a "Subtitle Test" tiddler and wrote: Hey. This resulted in it appearing right next to the date (under the title) with no space between the time and Hey. When I added "  Hey" (with no quotation marks), the expected and hoped for space appeared between the date and Hey.

9th October 2020 at 10:21pm  Hey.

I'm not sure what this part means in what I should be looking for:
  • Are the number of characters below 1300 they fit in a linked in post
  • Are the number of characters above 1300 and under 125,000 they fit in a linked in Article.
How I'm interpreting it is that if the subtitle text is below a certain amount, it'll fit in the subtitle area. So I adjusted and set the below level as 10. After I put in ~60 dummy text and checked again, all ~60 words still showed up in the subtitle field. I'm certain that I'm not understanding your intentions. 

Best, 

LG

On Fri, Oct 9, 2020 at 12:42 AM TW Tones <anthon...@gmail.com> wrote:
Lg,

I was working on a small project to create subtitle tags, basically using the tag $:/tags/subtitle you can place items in the tiddler subtitle.

This text size measure sounded like an ideal candidate.
  • Using the suggestions in this thread for words and characters
  • I also added two value tests
    • Are the number of characters below 1300 they fit in a linked in post
    • Are the number of characters above 1300 and under 125,000 they fit in a linked in Article.
If you install this JSON then open $:/PSaT/subtitle-tags/text-size and you can see how I did it and adjust to you needs.

Note It modified the core tiddler 

$:/core/ui/ViewTemplate/subtitle


Any feedback will help me publish it.

Regards
Tony

On Monday, 5 October 2020 11:58:50 UTC+11, LG wrote:
I copied all of my writing into one TW file. Is there a way to get a total word count? There are 823 tiddlers. 

--
You received this message because you are subscribed to a topic in the Google Groups "TiddlyWiki" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/tiddlywiki/6acL1HS8Zws/unsubscribe.
To unsubscribe from this group and all its topics, send an email to tiddl...@googlegroups.com.

Amanda L. Goodman

unread,
Oct 11, 2020, 1:29:58 PM10/11/20
to tiddl...@googlegroups.com
Hello, Tony!

Well, that's what I get for trying to read when I'm so tired. I tried that and this is what I'm seeing now: 

11th October 2020 at 1:16pm   

I checked it several times against other word counters to ensure that it is accurate. I'm guessing the "359 in-post" refers to all of the TiddlyWiki code? 



To unsubscribe from this group and all its topics, send an email to tiddlywiki+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/tiddlywiki/3577e75b-8e16-4f56-a74f-277bc6301560o%40googlegroups.com.

TW Tones

unread,
Oct 11, 2020, 5:09:22 PM10/11/20
to TiddlyWiki
LG,

The first is a character count in the current tiddler, the second the word count in the current tiddler.

Sorry if I have confused you, I think I assumed too much.

Regards
Tones

Amanda L. Goodman

unread,
Oct 12, 2020, 11:01:58 AM10/12/20
to tiddl...@googlegroups.com
Thanks for the clarification! 

It appears to be working well on my end. 

To unsubscribe from this group and all its topics, send an email to tiddlywiki+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/tiddlywiki/7a9c1184-e7cf-4c00-8278-3bc975736d22o%40googlegroups.com.

Aidan Grey

unread,
Oct 12, 2020, 2:37:52 PM10/12/20
to TiddlyWiki
Is there a way to shift that count into a variable, so that one could calculate, say, how many pages that word count equates to?

[[the word count]divide[250]round[]]


You received this message because you are subscribed to the Google Groups "TiddlyWiki" group.
To unsubscribe from this group and stop receiving emails from it, send an email to tiddlywiki+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/tiddlywiki/CAFWQ5Z4VsQnjPSv9PzAsRzfxeNjRRk%2BR6BeASoL2REcNe6_oyA%40mail.gmail.com.

TW Tones

unread,
Oct 12, 2020, 5:07:38 PM10/12/20
to TiddlyWiki
Aidan,

That should be trivial in both the whole of wiki and tiddler focused counts.

Here I have added it to my subtitle macros.

<$list filter="[all[current]get[text]length[]compare:number:gt[0]]" variable=size>
<$button tooltip="Size in characters of the current tiddler" class="tc-btn-invisible">
{{$:/core/images/size}}<$text text=<
<size>>/><$text text={{{ [<size>compare:number:lteq[1300]then[ in-post]] }}}/><$text text={{{ [<size>compare:number:gt[1300]compare:number:lteq[125000]then[ in-article]] }}}/>
<$text text={{{ [all[current]get[text]splitregexp[\s+]count[]] }}}/> Words
<$text text={{{ [all[current]get[text]splitregexp[\s+]count[]divide[250]round[]] }}}/> Pages
</$button>
</$list>

This idea of obtaining details from the text field hints at a possibility I have raised a few times, that is of analytics in Tiddlywiki. 
  • There are a lot of ways to measure, log and collate information in tiddlywiki. 
  • While analytics is used by the big IT players it has also being recognised that providing rich analytics back to the user about their own data, is a great source of insight.
  • I have a thought experiment I am working on to build effective analytics based on data as it arrives rather than just a calculation at a particular time. 
  • I also raised color intuitions to bring forward such analytics to allow ones intuition to work with the info.
Regards
Tones


On Tuesday, 13 October 2020 05:37:52 UTC+11, Aidan Grey wrote:
Is there a way to shift that count into a variable, so that one could calculate, say, how many pages that word count equates to?

[[the word count]divide[250]round[]]


On Mon, Oct 12, 2020 at 9:01 AM Amanda L. Goodman <Ama...@godaisies.com> wrote:
Thanks for the clarification! 

It appears to be working well on my end. 

--
You received this message because you are subscribed to the Google Groups "TiddlyWiki" group.
To unsubscribe from this group and stop receiving emails from it, send an email to tiddl...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/tiddlywiki/CAFWQ5Z4VsQnjPSv9PzAsRzfxeNjRRk%2BR6BeASoL2REcNe6_oyA%40mail.gmail.com.

Aidan Grey

unread,
Oct 12, 2020, 5:41:22 PM10/12/20
to TiddlyWiki
Aha!! I was trying to transpose the {{{s to [[s. Thank you!!

text={{{ [all[current]get[text]splitregexp[\s+]count[]divide[250]round[]] }}}  
To unsubscribe from this group and stop receiving emails from it, send an email to tiddlywiki+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/tiddlywiki/cd9e539e-c399-4938-98c9-2d5a722c3b51o%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages