Tinderbox Forum

Playlist: Building a Second Brain: Exploding & Distilling Kindle Notes

Greetings!

Tinderbox can be used to create good things. Implementing “Building a Second Brain” (BASB} principles can be used to create good things.

Learning how to use Tinderbox while constructing a second brain is my present venture. This is a joyful venture made more so by the insights, wisdom, good humor, and ideas many of you have shared with me and others.

I will be sharing what I learn via a YouTube playlist: Tinderbox How To

Thank you, Michael Becker, for inspiring me to jump into YouTube video publishing. Yours are always helpful!

Building a Second Brain: Exploding and Distilling Kindle Notes videos are being created and posted to the playlist. Each will be five minutes or less in duration.

The Scope:
From: Having Captured (Kindle notes) To: Distilling (Tinderbox)

Sequence

  • Introduction & Preparatory - Introduction

  • Refactor 0 - Part A - Part B

    • Exploding using delimiter of regex pattern #1
  • Refactor 1 - (in work)

    • Exploding
      • Using delimiter of regex pattern #2
      • Prototypes: Creating and Setting
      • Action Code: Assigning prototype
      • Attributes: Creating
  • Refactor 2 - (in work)

    • Stamps (no exploding (sad face))
      • Creating
      • Using stamps to update note attributes
  • Refactor 3 - (in work)

    • Stamps (with exploding, too)
      • Create combination stamp
      • Explode using combined stamp to set attributes
  • Refactor 4 - (in work)

    • Distilling workflow
      • Demonstrate
4 Likes

This is awesome. I’ve added your video to Mastering Tinderbox: Training Videos (Complete List) and edited the category to include it in the “Training Videos.”

1 Like

Created Refactor 1 video
Exploding BASB Kindle Notes: Creating Prototype | Setting Prototype Action code

  • Exploding
    • Using delimiter of regex pattern: Highlight.\([a-z A-Z]*\)...(?=Chapter)
    • Prototypes: Creating
    • Attributes: Creating
    • Action Code: Assigning created prototype during Explode
2 Likes

Love it!

Created Refactor 2 Video - Exploding BASB Kindle Notes: Creating Stamps | Setting Attributes using Stamps

  • Creating Stamps
  • Using Stamps to Set Note Attributes
Stamps Code
(Each “if…” is one line)

**setKindleChapterFromText**
if($Text.contains("(Chapter).(\d+):.([^>]*).>.(Page).(\d+).([^>]*).(Location).(\d+)")) { $kindleChapter = $2;}

**setKindlePageFromText**
if($Text.contains("(Chapter).(\d+):.([^>]*).>.(Page).(\d+).([^>]*).(Location).(\d+)")) { $kindlePage = $5;}

**setKindleLocationFromText**
if($Text.contains("(Chapter).(\d+):.([^>]*).>.(Page).(\d+).([^>]*).(Location).(\d+)")) { $kindleLocation = $8;}
1 Like

Really interesting thread. Thanks for sharing and for all the unseen extra effort put into describing your process. I like your explicit reference to doing small tests first, an important assistive process we all to overlook … until after it would have avoided a bigger misstep. :slight_smile:

3 Likes

Created Refactor 3 Video - Exploding BASB Kindle Notes: Chaining Stamps | Combining Stamps

  • Stamps (with exploding, too)
    • Create combination stamp
    • Explode using combined stamp to set attributes
# ~~~~~~~~~~~~~~~~~~~ Explode with Chained Stamps~~~~~~~~~~~~~~

Delimiter:
Highlight.\([a-z A-Z]*\)...(?=Chapter)

Action Code:
$Prototype="pKindleNote";stamp("setKindleChapterFromText");stamp("setKindlePageFromText");stamp("setKindleLocationFromText");

# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

# ~~~~~~~~~~~~~~~~~~~ Combined Stamp Code ~~~~~~~~~~~~~~

Name:
setKindleAttributesUsingKindleStamps

Code:
if($Text.contains("(Chapter).(\d+):.([^>]*).>.(Page).(\d+).([^>]*).(Location).(\d+)")) { stamp("setKindleChapterFromText"); stamp("setKindlePageFromText"); stamp("setKindleLocationFromText");}

# ~~~~~~~~~~~~~~~~~~~ Explode with Combined Stamp ~~~~~~~~~~~~~~

Delimiter:
Highlight.\([a-z A-Z]*\)...(?=Chapter)

Action Code:
$Prototype="pKindleNote";stamp("setKindleAttributesUsingKindleStamps");

# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 Like

Created Refactor 4a Video - Tinderbox: (a) Distilling Workflow: Stamp for Removing Metadata

Created Refactor 4b Video - Tinderbox: (b) Distilling Workflow: Stamp for Removing Metadata

Stamps

  • Distilling Workflow demonstration
  • Create removeChapterPageLocationString stamp
  • Apply stamp to remove metadata

FYI: One of the meet-up members shared helpful, wise feedback. I plan on refactoring my regex patterns. Thank you meet-up peoples!

# ~~~~~~~~~~~~~~~ Stamp Code ~~~~~~~~~~~~~~~~~~~~~~~~~~
Name:
removeChapterPageLocationString

Code:
$Text=$Text.replace("(Chapter).(\d+):.([^>]*).>.(Page).(\d+).([^>]*).(Location).(\d+)"))", "");

# ~~~~~~~~~~~~~~~ end of Stamp Code ~~~~~~~~~~~~~~~~~~~~~~~~~~
2 Likes

Created Refactor 5 Video - Exploding BASB Kindle Notes: Improved Regex | Best Practices

Improving based on insights provided by one of our wise TB Forum people.

Regex

  • Creating Improved Regex

Stamps (with exploding)

  • Creating Improved Stamp
  • Using Stamps to Update Note Attributes
# ~~~~~~~~~~~~~~~~~~~ NEW: setKindleAttributesFromText Stamp Code ~~~~~~~~~~~~~~

Name:
setKindleAttributesFromText

Code:
if($Text.contains("Chapter.(\d+):.[^>]*.>.Page.(\d+).[^>]*.Location.(\d+)")) { $kindleChapter = $1; $kindlePage = $2; $kindleLocation = $3;}

# ~~~~~~~~~~~~~~~~~~~ Explode with setKindleAttributesFromText Stamp ~~~~~~~~~~~~~~

Delimiter:
Highlight.\([a-z A-Z]*\)...(?=Chapter)

Action Code:
$Prototype="pKindleNote";stamp("setKindleAttributesFromText");

# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2 Likes

Another helpful video and nice. The point about careful use of regex, back-references and scale is a subtle one. When starting out and without a background in regex (regular expressions), any successful result is a win.

The gentle point re ‘best practice’ is that if you start out doing things that may not matter now but may affect you later, that is also a win as you won’t have to re-factor (improve) existing code.

Importantly, in a test doc the size of the demo, don’t expect to see any difference in behaviour. You are doing these optimisations to help you future self. :slight_smile:

To give some insight on the scale. IIRC, the original regex had to make 6 back-references and the regex was run 3 times per note: 18 back-reference creation tasks. This demo makes 3 and the stamp is used once, so 18 tasks → 3 tasks for just a single note. 18/3 is a reduction factor of 9. In a small doc, of no significance. In a note with several thousand notes, perhaps less trivial.

Importantly too, the ‘effort’ involved in regex is not a design quality issue of Tinderbox. Regex are a general software function: under the hood they do complex work and complex work normally takes more time/effort than simple work regardless of software language/code used—a constraint the app can’t work around but the user’s thoughtful employment of the feature can.

1 Like