I'm sure this could be accomplished a lot more efficiently, but here's my attempt to add spaced repetition functionality to OmniOutliner 3. The goal is more efficient memorization using the
SM-2/SuperMemo algorithm. (I hope I implemented the formula correctly). Flashcard programs like Anki and Mnemosyne are great, but it's tough to see the context of what you're learning, and in law context is very important. Using OmniOutliner, the row text can serve as a question and the note text as the answer. Columns 3, 4, 5, and 6 are used to store the information about past and future repetitions.
Code:
tell application "OmniOutliner"
-- columns:
-- 1 is checkbox (unused)
-- 2 is for content (questions in the row; answers as comments)
-- 3 is quality
-- 4 is due
-- 5 is numReps
-- 6 is EF
set baseEaseFactor to 1.3
set i to value of cell 5 of selected row of front document -- number of repetitions thus far
set q to value of cell 3 of selected row of front document -- Get quality #
-- Set existing easiness factor...
if value of cell 6 of selected row of front document contains "" then
set value of cell 6 of selected row of front document to baseEaseFactor as text
set oldEF to baseEaseFactor
else
set oldEF to value of cell 6 of selected row of front document -- Get oldEF
end if
-- If there have been no reps:
if i as integer is equal to 0 then
set nextDue to do shell script "date -v+0d +%Y-%m-%d" as string
set value of cell 4 of selected row of front document to nextDue as string
set value of cell 5 of selected row of front document to "1" as string
set value of cell 6 of selected row of front document to baseEaseFactor as string
return
-- If there have been 2 reps:
else if i as integer is equal to 1 then
set i to i + 1
set value of cell 5 of selected row of front document to i as string
set dueCellValue to do shell script "date -v+1d +%Y-%m-%d" as string
set value of cell 4 of selected row of front document to dueCellValue as string
return
else if i as integer is equal to 2 then
set nextDue to do shell script "date -v+6d +%Y-%m-%d" as string
set value of cell 4 of selected row of front document to nextDue as string
set value of cell 5 of selected row of front document to "3" as string
set value of cell 6 of selected row of front document to baseEaseFactor as string
return
else -- all other numbers
set value of cell 5 of selected row of front document to i + 1 as string
set newEF to oldEF - 0.8 + 0.28 * q - 0.02 * q * q
if newEF is less than 1.3 then
set newEF to 1.3
end if
if newEF is greater than or equal to 2.5 then
set newEF to 2.5
end if
set value of cell 6 of selected row of front document to newEF as string
if q > 0 then
set nextDue to (i * (i - 1) * newEF) as integer
set dueCellValue to do shell script "date -v+" & nextDue & "d +%Y-%m-%d"
set value of cell 4 of selected row of front document to dueCellValue as string
set i to i + 1
set value of cell 5 of selected row of front document to i as string
else
set nextDue to do shell script "date -v+0d +%Y-%m-%d" as string
set value of cell 4 of selected row of front document to nextDue as string
set value of cell 5 of selected row of front document to "0" as string
end if
end if
end tell
I've got more written up about this on
my site, along with simpler spaced repetition routines for some other software (VoodooPad and EagleFiler).