How to automatically detect memory text correctness

Detects whether the text content in the tiddler with the title name in lowercase exists in the tiddler with the title name in uppercase. If so, the text background in the highlighted lowercase tiddler is “lightgreen”. If not, the text background in the highlighted lowercase tiddler is “lightpink”.

Any reply would be greatly appreciated

Not really sure why you would need this, but try this:

\function word.found() [all[]] :map[<currentTiddler>addprefix[@@background-color:lightgreen;]addsuffix[@@ ]]
\function word.missing() [all[]] :map[<currentTiddler>addprefix[@@background-color:lightpink;]addsuffix[@@ ]] 
<$let document="empty"
          sourceText={{{[<document>lowercase[]get[text]]}}}
          targetText={{{[<document>uppercase[]get[text]]}}}
          newText={{{[<sourceText>split[]] :map[<targetText>search<currentTiddler>then<word.found>else<word.missing>] +[join[]]}}}
>

<<newText>>

image

1 Like

Thank you very much for your help. Your skills are excellent. The code runs very well

How to make the result of a function display better in any set of lowercase letter titles tiddlers? I have created a large number of English vocabulary memory detection cards, and setting each one with "<$let document=“words” is laborious

Mmmm, I think this is some sort of vocabulary flashcard application but It’s not entirely clear to me how you intend to use it.

Generally, using just uppercase and lowercase titles to differentiate between two groups of tiddlers doesn’t seem like a good idea. To play to the strength of Tiddlywiki, you may want to tag them instead with tags like “#dict” or “#vocab” for uppercase vocab tiddlers, and maybe “#card” or “#sentence” for lowercase tiddlers; I’m not sure how you intend them to be used. Then you can use [all[tiddlers]tag[#vocab]] for a list of all vocab tiddlers, or [all[tiddlers]tag[#sentence]] for a list of all sentence tiddlers.

For a particular sentence tiddler whose title is in a <test> variable, you can use [title<test>tag[#sentence]] to retrieve the sentence tiddler or [title<test>tag[#vocab]] to retrieve the corresponding vocab tiddler. This works because [title<test>...] defaults to a case insensitive title search like [field:title<test>...], and returns both the uppercase and lowercase vocab and sentence tiddlers, and tag[#vocab] further narrows it down to the vocab tiddler.

Oh btw, there is a chinese Tiddlywiki forum 首页信息流 | 太微中文论坛 (tidgi.fun) where you may be able to get help from chinese TW users.

1 Like