I am new to TB and preparing to begin using it for large scale academic note keeping. I’ve done the help example document project (with books and films) and now I want to move onto a small scale preliminary project, albeit with genuine value and data.
I’d like advice on how to get a large block of text into notes with some user attributes set. The plaintext data looks like this:
Parker 61 Rage Red, (F nib), Deluxe lustralloy with gold clip cap*
Parker 61 Grey (F or M nib?) Nickel and Silver Legacy cap (nickel in the “lines”)
Parker 61 Vista Blue (Stub nib?), Heirloom, green and orange/rose*
(loose arrow) pre-1962
eBay £28+£3 postage
I would like to have each of those three pens become a note and I would like to populate some user attributes with values gleaned from the text, e.g. brand, nib, price, which I can extract using regular expressions. Any residue (i.e. text not extracted into attributes) I’d like to leave in the note text (although I don’t mind if all the text stays too).
I understand that I could paste all the text into one note; then explode that note using the paragraph boundaries to get one note per pen. I recall that I can use the explode settings to set an OnAdd that will give all the notes a prototype, and that the prototype can have the user attributes I want my notes to have.
How though do I then extract the values from the note text and assign them to user attributes? Should I do this with an Agent that munges the notes; or a Rule inherited from the prototype? Should I (can I) try do all the extraction and attribute setting in one Agent/Rule script or do one attribute, then change the script, until done? What is the general form of a script that searches the note text to extract a value into a key attribute?
I am willing to massage the data in a text editor beforehand using regular expressions and the like. If so, is there something I can do to make this much easier or more reliable (e.g. prepend some delimiter)? For example, I could probably munge it all into CSV or TSV, but will that help with my attribute setting?
Thank you for any advice you can lend me.