Would it be possible to perform a search by word frequency on tiddlywiki?

I’ve been using tiddlywiki for exactly 2 weeks, but one difficulty I have is finding specific documents without tags that I forgot to add. I recently thought of a feature to find documents by word frequency so I could find documents without tags that I forgot to add.

A non-linear way to search for documents would be to search for documents by word frequency. There is an extension I use called “wordy”, would it be possible to have such an algorithm on tiddlywiki?

Is it possible to do a word frequency search on tiddlywiki as “wordy”?

image

  • https:// github .com /angus-c/wordy-extension

Would it be possible to perform a search by word frequency?

I’m not sure if that’s what you want but some times ago I made a “statistic” tiddler for a book of a friend of mine that I ported to tiddlywiki. It’s able to count words and rank tiddlers by frequency of appearance (useful to see which character appears the more often in the story and in what chapter). It’s in french though so I will need to translate it to english. Would that fit what you want ?

It also calculate the reading time. Here’s a screenshot translated to english using a browser extension :

1 Like

Here’s a simplified version :

<$edit-text field="word"/>

<$let search={{!!word}}>

<ul>
<$list filter="
[!is[system]]
:filter[<search>minlength[3]]
:filter[search:text,title<search>]
:sort:number[{!!text}split<search>count[]add[-1]]
+[reverse[]]">
<li><$link/> : <$count filter="[{!!text}split<search>butlast[]]"/></li>
</$list>
</ul>

</$let>

demo : How to count words frequency

4 Likes

Have you tried TW-Indexer:
Tiddlywiki Indexer — create subject/author indexes (kookma.github.io)

2 Likes

Wonderful. I just tried on tiddlywiki.com

image

What are those zeros?

Does it search in title also?

Good catch ! There was an error in the counting method, I corrected it. Try this :

<div class="search-field tc-search">
<$edit-text field="search" placeholder="search"/>
<$list filter="[{!!search}minlength[3]]" variable=_>
<$button set="!!search" setTo="" class="tc-btn-invisible">
{{$:/core/images/close-button}}
</$button>
</$list>
<$button class="tc-btn-invisible" disabled="yes">
{{$:/core/images/advanced-search-button}}
</$button>
</div>

<$let search={{!!search}}>
<ul>
<$list filter="
[!is[system]]
:filter[<search>minlength[3]]
:filter[search:text<search>]
:sort:number[{!!text}split<search>count[]]
+[reverse[]]"
>
<li><$link/> : {{{ [{!!text}split<search>butlast[]count[]max[1]] }}}</li>
</$list>
</ul>
</$let>

This only search the text field.

3 Likes

Very nice! It works!

would it be possible to do a keyword frequency search within a percentage?

Something like this ?

<$edit-text field="search" placeholder="search"/>
<$list filter="[{!!search}minlength[3]]" variable=_>
<$button set="!!search" setTo="" class="tc-btn-invisible">
{{$:/core/images/close-button}}
</$button>
</$list>
<$button class="tc-btn-invisible" disabled="yes">
{{$:/core/images/advanced-search-button}}
</$button>
</div>


<$let 
search={{!!search}} 
sum={{{ [!is[system]search:text<search>]:filter[<search>minlength[3]]+[get[text]join[]split<search>butlast[]count[]max[1]] }}}
>
<ul>
<$list filter="
[!is[system]]
:filter[<search>minlength[3]]
:filter[search:text<search>]
:sort:number[{!!text}split<search>count[]]
+[reverse[]]"
>
<li><$link/> <$text text={{{ [{!!text}split<search>butlast[]count[]max[1]divide<sum>multiply[100]fixed[2]] }}}/>%</li>
</$list>
</ul>
</$let>
1 Like

Hi! yeah! yes! exactly…

@telumire @atronoush how do i create a plugin from that?

You can use this to easily create a plugin : Gatha Studio Workspace — create and export plugins, editions, and packages in browser

But I’m not sure how this would be useful, why do you want to do that ?