Lumar-BookOfKindness

BOOK DESCRIPTION: “Something Kind” by Lumar is a book that is computationally generated, leveraging human computation through Amazon Mechanical Turk, several short programs in Processing, and Basil.js.

The text of the book consists of responses provided by Amazon Mechanical Turk workers, when they were asked to “write about something unexpectedly nice that someone did” for them. The program incorporates the RiTa library for content analysis, and singles out the pertinent action verbs of each quote to display on the facing page spread. Altogether the book emphasizes kindness as an action – and ends the book with the actions “GO & DO” with some gradual play on flipbook transitions through both the heart imagery and verb spread/sizing.

bookkind

_dsc2169-copy

_dsc2170-copy

_dsc2171-copy

The action verbs on the page spreads all eventually get redder, smaller and darker the closer the book gets to the end with the last verb page being “GO & DO” in smaller font at the bottom of the page.

screen-shot-2016-10-28-at-4-53-15-pm

I ended the book with a screenshot of an email a Turker sent me thanking me for the HIT (task)! Wow! I was touched! I’m really glad she liked it!screen-shot-2016-10-28-at-4-53-25-pm

 

REGRETS: Besides not being able to execute some parts of the original idea (the original sequence held more of a sentiment of a personalized gift of kind moments book) I had really wanted the extracted verbs to be written in a different color directly within the quote. I had gotten the program to send to the json file the index values of the words I wanted highlighted within the quote if it was a word array, but having the color be unique for a single or couple index values of a string in Basil was difficult. I had not managed to figure it out.

An idea I had before the book of kindness:

scan-6

Physical book of kindness brainstorms:

scan scan-1

I had really wanted the design of the pages to be cognizant of the fact that as a physical book, it had depth and extra dimensions to play with. So while the hearts on each page look as if they are traveling bit by bit to be more fully on the page, the edge it leaves helps form a half heart on the side of the book – which helps form an entire heart when you look at the book from an angle.

Metaphorically, I like the aspect of a heart emerging the deeper into the book you are.

Maeda media was an inspiration! Thank you Golan for the recommendation!

Originally I really wanted the the flipbook heart feature to have more than just a moving heart, but in fact a question mark on the outside side edge of the book – as if the title “Book of kindness” or “Something Kind” ended in a “?” as it wrapped around the corner. The “?” would be lerped gradually into a exclamation mark that would end the book be reaffirming that kindness is an action!!! Exclamation! No more “?”.

 

Idea:

Enter a time (perhaps someone’s birthday, a time you are feeling really down, the date of someone’s death, etc)

Through Temboo – program runs through twitter to finds  365 tweets that have the word “hate” (or “sad” /”lonely”?) in it posted at that time.

It then sends a mechanical turk request for human computation to spurt out 365 examples of either—–

1. An unexpected act of kindness

Take a moment to remember something nice that someone did for you recently, that you weren’t expecting. In a single sentence or two, please describe what happened, and how it made you feel.

Here are a couple examples of what your sentence might look like:

  • One of my roommates cleaned up the fridge in our apartment.
  • I was running late and in a big hurry. A man let me cut in front of him in the line at Starbucks.

//3. A specific little detail of life that makes them smile or laugh

4. A link to a post, picture, quote, gif, video, etc that inspires, uplifts, makes them smile, etc (the program will take that link and generate a visual qr code to include)

Given this, the hate quote is printed really small in black and white on one side of a two page spread, and the happier result on the other side at the edge of a page in a lerping gradient color from the rainbow in relation to the page’s place in the book.

The height position of the happy quote is determined by the page’s position within the book in relation to an arc formula – that way when you flip through the book quickly, the flip book animation is that of a rainbow arching.

or like maeda @ media – the quotes printed at the edges creates a word when you see the book from the side – a sketchbook for somebody

The words/sentences are then processed by RITA to be ordered to rhyme

The VERBS are then processed by RITA and the typography is different to emphasis ACTIOOOONNN


PROCESS/what actually happened:

  1. Index.html Page request form  Wasn’t able to get automated external hit request to amazon to work – something about my AWS authentication key not working? So I ended up just manually submitting requests through the gui request maker amazon provides instead.
  2. External Hit Initialization (use Boto SDK to access Amazon Web Services API)   Tried Boto, AWS authentication key wrong, and just a lot of plumbing issues that didn’t necesarily have to do with art or code…and trying out a different SDK like mturk.js was not something I could figure out/learn quickly enough before the free book deadline. Ah…the joys of plumbing.
  3. Illustration generator see below
  4. Verb identifier & selector see below
  5. JSON Content file generator see below
  6. Basil.js script see below
  7. was on a flight – didn’t check email about extension I learned to bind books by hand!!! It was fun – if incredibly time consuming. My book binding process is below

screen-shot-2016-10-23-at-9-06-17-pm

Wrote a processing program to create the flipbook heart illustrations that go on each page by exporting each frame.heartpages

And then in Photoshop, I took all the pages and created an action series (1. reflect over the vertical axis, 2. save, 3. close file) and was able to automate the batch. All 53 illustrations were flipped horizontally in 3.256 seconds :). LOL….but it took a good chunk of time to figure it all out…../fix issues

hearts

 

Wrote an additional processing program that ran through all the quotes from amazon mechanical turk workers leveraging the RiTa library to identify and single out the verbs in the strings. All the verbs are subsequently gathered into an array – wherein I manually chose which verbs I wanted to include. This list of selected verbs is then used in the next program.

Wrote another processing program to create the json file of all the content each page of the book should have. It took the collection of strings from the csv doc of the turker results, the turker’s ID, a corresponding image file, and an array of all the highlighted verbs within the quote.

It generates differently each time (almost – the string data from the turkers stay consistent because I didn’t pay for more….)

See pdf:

bookofkindness

bookofkindness2

somethingkindagain

Flipping through the pages —  the heart translates closer and closer to the center as the book progresses, this allows the edge to create the heart shape on the side.

Here’s a video of Golan flipping through the book:


 

Hand bound the book by organizing the 112 pages into smaller booklets called ‘signatures’ of 4 large sheets printed double sided with spreads – which translated to 16 pages per pamphlet which were then sewn together.

scan-4img_1827

 

screen-shot-2016-10-28-at-2-37-06-am
7 different pdfs for the 7 different signatures needed

The wonkiness of the printing was actually not a computational error on my part, but the side effect of an act of kindness I received!

I had really loved the paper luster of the 80 lb, but my code wasn’t made for that (the measurements of the heart illustration and the placements weren’t adjusted for the widths of the 80 lb papers adding up, I had 50 lb in mind). Fedex only had 32lb and 80 lb. But the 32 lb paper didn’t feel nearly as good. So I had sighed, and grudgingly still went with the 32 lb – it would be narrower than I would’ve liked for the heart’s side edge, but would suffice. Especially since 80 lb printing would cost me $144.

But when I had picked up the order, the fedex guy said he printed it all out on 80 lb paper for me instead, and that he didn’t charge me the extra $70.

….DDISSSAAASSSSTTTEEER!!! HOW COULD I SAY NO?! I couldn’t just ask him to redo 112 pages of $144 printing!

I also thought it added to the meaning of the book – this book was made with the help of an act of kindness.
Here’s the heart generator code:

import processing.pdf.*;
boolean bRecordingPDF;
int pdfOutputCount = 0; 

int numofpg = 53;
int whatpg =0;
float r;
float g;
float b;
float rr;
float gg;
float bb;
float rdiff;
float gdiff;
float bdiff;
void setup(){
  bRecordingPDF = true;
  frameRate(5);
  size(116, 159);
  r = random(100,255);
  g = random(100,235);
  b = random(100,235);
  rr = 255;
  gg = 120;
  bb = 120;
  println("("+r+","+g+","+b+")");
}
void draw(){
  background(255);
    if (bRecordingPDF) {
      if(whatpg<=numofpg){
     beginRecord(PDF, "heart" + pdfOutputCount + ".pdf");
    translate(width-whatpg,height/2.4);
    
    
    noStroke();
    float red = map(whatpg,0,numofpg,r,rr);
    float green = map(whatpg,0,numofpg,g,gg);
    float blue = map(whatpg,0,numofpg,b,bb);
    fill(red,green,blue);
    PShape heart = createShape();
    heart.beginShape();
      for (int i=0; i<50; i++){
        float t = i*2*PI/50;
        float x = 3.3*(16*pow(sin(t),3));
        float y = -3.3*(13*cos(t)-5*cos(2*t)-2*cos(3*t)-cos(4*t));
        heart.vertex(x,y);
      }
    heart.endShape();
    shape(heart, 0, 0);
    whatpg++;
  }
    endRecord();
    bRecordingPDF = false;
    pdfOutputCount++;
  }
}
void keyPressed() {
  // When you press a key, it will initiate a PDF export
  bRecordingPDF = true;
}

Here is the code that identifies the verbs!

 
import rita.*;
String[] kindverbs = {"hired","save","accept","asked","volunteering","make","made","makes","cursed","thanked","waiting","bought","shocked","given","ask","moved","paying","pray","surprised","helped","pay","offered","give","remember","remembering","gave","inspired","improve","paid","thank","help","making","enjoy","blessed","appreciated","cheered","touching","vouched","listening","cared","touched","wrote","promised","served","found","understood","understand","assured","strive"};
JSONArray[] highlight = new JSONArray[50];
String[] rawKindness = {
   "A coworker hired me for extra work, because she knew I was trying to save up money. At first I was hesitant to accept because she asked me before she asked her assistant, but it was okay with the assistant. I was grateful that she thought of me for the task, which was something I would have been happy volunteering to do.",
 "My neighbor stopped by my house and brought me a cinnamon broom. Those are those little straw brooms that you see in the stores in the fall that make the house smell really nice. It was so sweet of her and so unexpected! It made me very happy and it makes me happy every day when I see it.",
"I was in a hurry to get to the train station and cursed out a woman under my breath as I passed her.  Then, my wallet fell out of my pocket and onto the street.  She picked it up and handed it to me.  I thanked her sincerely and felt like a huge heel!",
"I was waiting on my friend to get back from doing something while in a Skype call with her.  We were about to play a game, however, she had told me to wait.  As soon as she got back, I had gotten an in-game notice stating she bought me an in-game item I have been wanting for quite some time, I was really shocked as she had already given me a couple other things prior to this so it was very unexpected and a huge surprise to me since I didn't ask for it.",
 "I was a single, 18 year old mother with my 1 year old daughter. I had just moved into my own place that was across the street from Walgreens. We walked together to grab some bread and applesauce. I was so embarrassed to be paying in change, and it was obvious the cashier was less than thrilled. As we were walking back across the street and go into the apartment complex a truck pulled up along side me. It was a husband and wife who told me I shouldn't be embarrassed and to be proud of how hard I was working. I was already in tears, and then they handed me a $20 bill, and that they'd pray for me. ",
 "This was over 10 years ago and I've never forgotten that moment. Still makes me tear up :)",
 "I was 7 months pregnant with my first child. My husband and I were visiting my parents and siblings who lived 9 hours away. I thought we were just picking up a crib my parents had bought us. Upon entering my parents house, we were surprised to see a bunch of close family and friends. It was a surprise baby shower for us! We were so happy to see everyone and receive so many, many gifts.",
 "I was in a very desperate financial situation and my best friend knew about it. So he knocked on my door and handed me $20. I was so, so thankful and grateful for that act, because I was able to buy food. I love him.",
 "I had a tire blow out on a rainy night while going off an off-ramp in the middle of nowhere.  A cop pulled over to see if I was alright, and let me borrow his umbrella.  He stayed there until I got my tire changed to make sure I was safe.",
 "My Mom recently made my husband and I sauerkraut with fresh rice (one of my favorite foods of hers). I was surprised and thrilled that she had made it for us - and also relieved, because we don't know how to cook that much nor have much money, and needed some healthy food desperately.",
 "My mother made me food when I was sick. She also helped me pay a bill to. It made me feel great and relived. It was a surprise.",
 "I stopped at a gas station last week because my car had ran out of gas. When I got to the station I realized I didn't have my wallet. Frantically looking around my car a nice woman asked if something was wrong to which I explained to her that I left my wallet. She offered to give me 5$ for gas to get on my way.",
 "I was at the grocery store just trying to buy a few things for dinner that night. Nothing real expensive, about $15-$20 worth of stuff. My card got declined. I had no other payment. I was going to leave the stuff there when the person in line behind me offered to just pay for it. I was really grateful and also super shocked because you don't see that kind of thing anymore.",
 "My car had broken down taking my kids to school. Another mother drove by and offered to take my kids to school. Then she was kind enough to return, picked me up and drove me home.",
 "I am usually the one to make sure the laundry is done for everyone in the house. For a few weeks I had been working really hard, trying to get in a lot of overtime, and in between working from home one evening I put a load of clothes in the washer. I completely forgot about them and before I fell into bed I remember the clothes. I rushed out to the washer to put the clothes in the dryer and saw my son had not only tried the clothes, but had folded them. I got tears in my eyes for how nice that felt.",
 "To be honest I had hard times remembering anything.. A couple weeks ago I was at the groceries store, an old man and I going to the cashier, he was in front of me: he picked the left line and I continued to the right. His line was going to be closed with the client before him so he moved to my line. I told him to pass in front of me and he replied he wasn't in a hurry because he was retired.",
 "One nice thing that someone did for me recently that I wasn't expecting was when my dad went to Trader Joe's and bought healthy food for me after I had been feeling unwell. He usually shops at a different grocery store , but he did it because he knew that it would be food that I would like.",
 "I was in the office before lunchtime somene gave me a candy, . It was super unexpected, I felt super good. I really I needed",
 "My sister surprised me by leaving fruit snacks at my front door the other day. I love fruit snacks. It was a small thing, but made my day.",
 "I was given a really nice compliment at work.  I was told I inspired someone to improve at their job and she got a promotion because of it.  It was incredibly heartwarming.",
 "I was in the drive-thru to pick up my starbucks for my office.  As I pulled up to the window, the barista told me that my order had been paid for by the car in front of me.  I was extremely grateful for the kindness and paid it forward when I could.",
 "It was late at night, and I had just gotten out of the gym. I walked to the parking lot, got in my car, and tried to start it, and the battery was dead. A fellow gym-goer came out shortly after, and I guess he heard me repeatedly try and start my car, which was unsuccessful. He walked up to my window and asked me if I needed a jump - and I said absolutely, yes, thank you! He pulled his car around, we got the batteries connected, and 30 seconds later I was on my way. What a life-saver! I was relieved to not have to waste money calling roadside assistance, and was quite frankly seriously positively surprised that someone would go out of their way to help me. It was very heartening, and I now make it a point to 'pay it forward' as far as these sorts of little kindnesses go.",
 "I was really tired and we were out of coffee. I had to go to a 7 hr online trainig class and didnt know how I'd make it through. My husband shows up with coffee for me, I was so happy and grateful.",
 "Our HR Manager was making cheese, egg and ham biscuits for everyone to enjoy one morning. I am a vegetarian and the ham was mixed in so I would not have been able to partake of the goodies. However she surprised me by making 4 separate ham  free biscuits just for me.  It was a very nice and welcome treat!",
 "My buddy let me sleep on his couch for a week.  I really needed a friend right then.  Felt great to have one pull through for me.",
 "I recently was cleaning my home and wanted to get rid of a lot of items around the house. I started early in the morning and was extremely surprised at how well the house was looking, for the first time in over a year the clutter was gone. But I noticed  I had lots of stuff out by the curb and wondering now if the city will pick it up.",
 "To my surprise my neighbor who has a truck  came over and loaded all the garbage on his truck and took it to the dump.",
 "I was so relieved that it was all gone. I felt so blessed to have such a nice neighbor.",
"A young lady offered me her seat on the subway.  Now, at 63 I'm not that old but I do have gray hair.  I appreciated her offer though I did not take her up on it - what a kind young lady.",
"It was surprising group kindness.  I went to a dance class tonight and the cirque class was doing dive cart wheels.  I thought I could do them and asked to join in.  The teacher let me.  I was the last one and the others cheered really loud when I did it.  Normally, we don't cheer in class, so it was a big surprise!  I'm almost 3 times older than them...I guess that might be the reason....but am not sure.",
"I had had a really bad day and a friend that I had been texting about stuff I had been going through was there for me. She gave up the rest of her afternoon at work and showed up at my apartment and took me to lunch and then we just sat and talked. Totally unexpected. Glad she gave me time.",
 "I had taken the day off work because I was very tired. My mom stopped by just to bring me a can of coke which she knows is my favorite drink. I felt like someone cares about me.",
"I had a fight with my boyfriend and was walking around our neighborhood which was in a downtown area. A homeless person bought me a beer and talked about angels and God. It was a really touching moment. I felt as though it was a message from above even if that sounds ridiculous.",
"I was in between jobs and really eager to get my foot in my career. I had posted an article on Facebook about the type of career I wanted, nothing too long and nothing like rant. A friend read it and messaged me right away, telling me she had a cousin who was in that field. Without me being able to reply, I got a text message from the cousin saying how my friend had vouched for me and if I would be available for an interview. Fast forward to now and I am loving my job! It was such a helpful extended act of kindness that changed my life.",
"My husband made the bed yesterday. I know it sounds trivial but it was a really nice surprise to walk in on. I hate making beds and I also hate sleeping in unmade beds so it meant a lot to me. It made me feel special and appreciated.",
"My dog was sick and I had just brought my favorite goat buck in for a second surgery. I was stressed out and upset because I have no other family than my animals. I was telling all this to a cashier at an organic grocer store I shop at. She an I have been friendly for over a year. After listening to me she said it hurt her to see me so sad and she asked me if she could give me a hug. I haven't had a hug from anyone in years so it made me feel like I was cared about by someone in a genuine way. I felt touched and sad at the same time, realizing just how long it had been since anyone showed me a tender act of care.",
"I was recently on the side of the road with a flat tire and a sweet boy stopped and changed my tire for me. I felt really thankful and also know there is still some good in this world.",
"A person who I didn't expect to show sympathy, actually was very upset when I told him about my mother's recent death - he even wrote a note.",
"I was out to dinner at Outback Steakhouse with my family (5 of us). My 3 young kids were being somewhat challenging, and I was a little stressed and not really enjoying my meal.  When we were done, the waiter came to us and said someone at the bar had paid for our meal, tip and everything. We immediately looked up, and no one was there. I was so in shock, confused, and happy....it really made my day.  I posted about it on Facebook and thanked the stranger who paid for our meal, and promised to pay it forward. I received a lot of positive feedback and comments from people.",
"My female cousin once unexpectedly baked a cake and served me a piece. I felt this was quite unusual since she's normally lazy and never does things like this (for anyone), although the inverse is not quite the same. I enjoyed it and found it unusual (the gesture), but coined it as a random act of kindness from her.",
"I was trying to buy a house and someone offered me the money I needed to put down on the house. I was over joyed and shocked that someone would help me in that.",
"I was in a video store (ok not extremely recently but it is what came to mind) and talking to my daughter about what we could get because I had rent due and was really short on money and it was just a bad time in general.  The next thing I knew a somewhat scruffy-looking guy came up and handed me a five dollar bill and kept walking.  I just stood there in shock for a little bit.  I was a little embarrassed, but is was such a nice thing for somebody to have done.",
"The grocery store where I shop regularly was crowded. I had other important work to do and was short on time. The helper at the grocery store understood my predicament  and helped me pay my grocery bill by opening a new counter. He really made my day!",
"One day, I happened to be in a town quite unfamiliar to me. The people there spoke a different language which I could not understand well. Similarly, they could not understand what I was telling them. I wanted to go to a hotel run by somebody who speaks my language. I knew only my mother tongue besides English. There gathered a number of taxi drivers  around me to take advantage of my miserable situation. Seeing the pathetic condition I was in, a young man stepped forward and asked what the matter was. He spoke in good English. I felt very much relieved and happy. I explained my situation and requested him to help. First he assured me that he was not a con and showed me a chain around his neck to prove that he was a devotee of one of the local Gods. He then called one of the taxi drivers and gave instructions as to where to take me. The taxi took me to a hotel whose owner spoke the same language as mine. I felt greatly grateful to the person who helped me in this difficult situation.",
"A man let me go in front of him at the grocery store when I only had a few items and he had a cart full.  I was very relieved because I had a rowdy toddler with me.  It was very nice of him and I was very appreciative.",
"I was on my way to one of my hardest midterms last year, physics. Unexpectedly, a girl was handing out packets containing snacks and other various test supplies out on campus, which was a really nice.",
"A man I had just met, changed the flat tube in my tire five minutes before the mountain bike race that we were both competing in. He did this without hesitation. Amazing.",
"I just did some groceries. I got some extra snacks and drinks. I saw a homeless senior citizen resting on a bench, and decided on a whim to share my snacks and drinks.",
"I was having a really bad day out of nowhere. My mom showed up to my apartment and brought flowers. She does not even live in the same town as me. It was very thoughtful of her. I felt grateful for her.",
"I always strive for a clean house but rarely get it. Not only did I walk into a clean house after work on my Birthday, but my man also got me the most beautiful flowers! I always want nothing but flowers for my day and this time he came through and then some! It was awesome and made me feel good.",
};
JSONArray values;
void setup(){
  values = new JSONArray();
  for(int i=0;i<rawKindness.length;i++){//go through the entire array of quotes to get to each quote
    String[] quote = RiTa.tokenize(rawKindness[i]);//make each quote into an array of words
    
    for(int j=0; j<quote.length; j++){//run through each word in the quote
      for(int k=0;k<kindverbs.length;k++){//test to see if it matches any of the desired verbs
        String quotedword = quote[j];
        String kindword = kindverbs[k];
        if(quotedword.equals(kindword)){
          //save the index values of the matching words within the quote
        }
       
      //add those index values into an array that gets out into the JSONarray of arrays
      }
    }
  }
}

 


JSON outputter:

 
import rita.*;
String[] images = new String[50];
String[] imageAgain = new String[50];
String[] id = {"A14OO6SSSYQQBL","A17LIM50IMQN7Y","A1CE2XPYCDRHVZ","A1EG66WQGRUPCS","A1GKTC682SWY23","A1L2T6S3WLN692","A1N91AUYC0H7S4","A1NKBXOTZAI1YK","A1O67YS3DU0ZHX","A1P1UEH9PMSHXG","A2JR1GWH41MLRB","A2LEY4X3LD8G26","A2M4YIC3XU2693","A2O2Q0LVWOWJ1G","A2VRDE2FHCBMF8","A2ZE2IPHK152KA","A30QV5VTBRGYTA","A31681CCEVDIH3","A38TZK07ON180S","A3NS1DN6J7Z3EU","AG5X553DRP557","AI4LKMF5QD07D","AITY0PTUTW9HW","AMPMTF5IAAMK8","AW5O1RK3W60FC","A2W7Z10Z5YLLF4","A3A8P4UR9A0DWQ","A2FBJV1VAI9SQ6","A2S3BJYB8MXB9A","A31LK6KUPJHPSP","A2L5GOTR5Y42X1","A1U6A617Q95MTZ","A1FFPO2ZR40NCD","A1MJYGGQ9RQUKX","A3CS3BQE8T1BU0","A3S0INU046UTYK","A2P6UJ9BKRPGUS","A03922113RU44GENR8ATX","A1RSAU5I9NZTOP","A27IUQDZPHETTP","A2A5YQTRSCLO32","A1UJFULCCBBIJI","A3JMJIKX36UNC7","A28JGET2XTPRG5","A2YRYS17DU3A8R","A17X4M2GVN70VB","AX0KHOWMMM6Z2","A10PVSMU1UBP8N","A116GKYM2O195O","A2DAZ0CJ3VKS80"};
//this is the array of arrays of indexvalues of indivudal verbs in each quote that need to change color
JSONArray[] highlightedIndices = new JSONArray[50];
String[] kindverbs = {"hired","save","accept","asked","volunteering","make","made","makes","cursed","thanked","waiting","bought","shocked","given","ask","moved","paying","pray","surprised","helped","pay","offered","give","remember","remembering","gave","inspired","improve","paid","thank","help","making","enjoy","blessed","appreciated","cheered","touching","vouched","listening","cared","touched","wrote","promised","served","found","understood","understand","assured","strive"};
String[] rawKindness = {
   "A coworker hired me for extra work, because she knew I was trying to save up money. At first I was hesitant to accept because she asked me before she asked her assistant, but it was okay with the assistant. I was grateful that she thought of me for the task, which was something I would have been happy volunteering to do.",
 "My neighbor stopped by my house and brought me a cinnamon broom. Those are those little straw brooms that you see in the stores in the fall that make the house smell really nice. It was so sweet of her and so unexpected! It made me very happy and it makes me happy every day when I see it.",
"I was in a hurry to get to the train station and cursed out a woman under my breath as I passed her.  Then, my wallet fell out of my pocket and onto the street.  She picked it up and handed it to me.  I thanked her sincerely and felt like a huge heel!",
"I was waiting on my friend to get back from doing something while in a Skype call with her.  We were about to play a game, however, she had told me to wait.  As soon as she got back, I had gotten an in-game notice stating she bought me an in-game item I have been wanting for quite some time, I was really shocked as she had already given me a couple other things prior to this so it was very unexpected and a huge surprise to me since I didn't ask for it.",
 "I was a single, 18 year old mother with my 1 year old daughter. I had just moved into my own place that was across the street from Walgreens. We walked together to grab some bread and applesauce. I was so embarrassed to be paying in change, and it was obvious the cashier was less than thrilled. As we were walking back across the street and go into the apartment complex a truck pulled up along side me. It was a husband and wife who told me I shouldn't be embarrassed and to be proud of how hard I was working. I was already in tears, and then they handed me a $20 bill, and that they'd pray for me. ",
 "This was over 10 years ago and I've never forgotten that moment. Still makes me tear up :)",
 "I was 7 months pregnant with my first child. My husband and I were visiting my parents and siblings who lived 9 hours away. I thought we were just picking up a crib my parents had bought us. Upon entering my parents house, we were surprised to see a bunch of close family and friends. It was a surprise baby shower for us! We were so happy to see everyone and receive so many, many gifts.",
 "I was in a very desperate financial situation and my best friend knew about it. So he knocked on my door and handed me $20. I was so, so thankful and grateful for that act, because I was able to buy food. I love him.",
 "I had a tire blow out on a rainy night while going off an off-ramp in the middle of nowhere.  A cop pulled over to see if I was alright, and let me borrow his umbrella.  He stayed there until I got my tire changed to make sure I was safe.",
 "My Mom recently made my husband and I sauerkraut with fresh rice (one of my favorite foods of hers). I was surprised and thrilled that she had made it for us - and also relieved, because we don't know how to cook that much nor have much money, and needed some healthy food desperately.",
 "My mother made me food when I was sick. She also helped me pay a bill to. It made me feel great and relived. It was a surprise.",
 "I stopped at a gas station last week because my car had ran out of gas. When I got to the station I realized I didn't have my wallet. Frantically looking around my car a nice woman asked if something was wrong to which I explained to her that I left my wallet. She offered to give me 5$ for gas to get on my way.",
 "I was at the grocery store just trying to buy a few things for dinner that night. Nothing real expensive, about $15-$20 worth of stuff. My card got declined. I had no other payment. I was going to leave the stuff there when the person in line behind me offered to just pay for it. I was really grateful and also super shocked because you don't see that kind of thing anymore.",
 "My car had broken down taking my kids to school. Another mother drove by and offered to take my kids to school. Then she was kind enough to return, picked me up and drove me home.",
 "I am usually the one to make sure the laundry is done for everyone in the house. For a few weeks I had been working really hard, trying to get in a lot of overtime, and in between working from home one evening I put a load of clothes in the washer. I completely forgot about them and before I fell into bed I remember the clothes. I rushed out to the washer to put the clothes in the dryer and saw my son had not only tried the clothes, but had folded them. I got tears in my eyes for how nice that felt.",
 "To be honest I had hard times remembering anything.. A couple weeks ago I was at the groceries store, an old man and I going to the cashier, he was in front of me: he picked the left line and I continued to the right. His line was going to be closed with the client before him so he moved to my line. I told him to pass in front of me and he replied he wasn't in a hurry because he was retired.",
 "One nice thing that someone did for me recently that I wasn't expecting was when my dad went to Trader Joe's and bought healthy food for me after I had been feeling unwell. He usually shops at a different grocery store , but he did it because he knew that it would be food that I would like.",
 "I was in the office before lunchtime somene gave me a candy, . It was super unexpected, I felt super good. I really I needed",
 "My sister surprised me by leaving fruit snacks at my front door the other day. I love fruit snacks. It was a small thing, but made my day.",
 "I was given a really nice compliment at work.  I was told I inspired someone to improve at their job and she got a promotion because of it.  It was incredibly heartwarming.",
 "I was in the drive-thru to pick up my starbucks for my office.  As I pulled up to the window, the barista told me that my order had been paid for by the car in front of me.  I was extremely grateful for the kindness and paid it forward when I could.",
 "It was late at night, and I had just gotten out of the gym. I walked to the parking lot, got in my car, and tried to start it, and the battery was dead. A fellow gym-goer came out shortly after, and I guess he heard me repeatedly try and start my car, which was unsuccessful. He walked up to my window and asked me if I needed a jump - and I said absolutely, yes, thank you! He pulled his car around, we got the batteries connected, and 30 seconds later I was on my way. What a life-saver! I was relieved to not have to waste money calling roadside assistance, and was quite frankly seriously positively surprised that someone would go out of their way to help me. It was very heartening, and I now make it a point to 'pay it forward' as far as these sorts of little kindnesses go.",
 "I was really tired and we were out of coffee. I had to go to a 7 hr online trainig class and didnt know how I'd make it through. My husband shows up with coffee for me, I was so happy and grateful.",
 "Our HR Manager was making cheese, egg and ham biscuits for everyone to enjoy one morning. I am a vegetarian and the ham was mixed in so I would not have been able to partake of the goodies. However she surprised me by making 4 separate ham  free biscuits just for me.  It was a very nice and welcome treat!",
 "My buddy let me sleep on his couch for a week.  I really needed a friend right then.  Felt great to have one pull through for me.",
 "I recently was cleaning my home and wanted to get rid of a lot of items around the house. I started early in the morning and was extremely surprised at how well the house was looking, for the first time in over a year the clutter was gone. But I noticed  I had lots of stuff out by the curb and wondering now if the city will pick it up.",
 "To my surprise my neighbor who has a truck  came over and loaded all the garbage on his truck and took it to the dump.",
 "I was so relieved that it was all gone. I felt so blessed to have such a nice neighbor.",
"A young lady offered me her seat on the subway.  Now, at 63 I'm not that old but I do have gray hair.  I appreciated her offer though I did not take her up on it - what a kind young lady.",
"It was surprising group kindness.  I went to a dance class tonight and the cirque class was doing dive cart wheels.  I thought I could do them and asked to join in.  The teacher let me.  I was the last one and the others cheered really loud when I did it.  Normally, we don't cheer in class, so it was a big surprise!  I'm almost 3 times older than them...I guess that might be the reason....but am not sure.",
"I had had a really bad day and a friend that I had been texting about stuff I had been going through was there for me. She gave up the rest of her afternoon at work and showed up at my apartment and took me to lunch and then we just sat and talked. Totally unexpected. Glad she gave me time.",
 "I had taken the day off work because I was very tired. My mom stopped by just to bring me a can of coke which she knows is my favorite drink. I felt like someone cares about me.",
"I had a fight with my boyfriend and was walking around our neighborhood which was in a downtown area. A homeless person bought me a beer and talked about angels and God. It was a really touching moment. I felt as though it was a message from above even if that sounds ridiculous.",
"I was in between jobs and really eager to get my foot in my career. I had posted an article on Facebook about the type of career I wanted, nothing too long and nothing like rant. A friend read it and messaged me right away, telling me she had a cousin who was in that field. Without me being able to reply, I got a text message from the cousin saying how my friend had vouched for me and if I would be available for an interview. Fast forward to now and I am loving my job! It was such a helpful extended act of kindness that changed my life.",
"My husband made the bed yesterday. I know it sounds trivial but it was a really nice surprise to walk in on. I hate making beds and I also hate sleeping in unmade beds so it meant a lot to me. It made me feel special and appreciated.",
"My dog was sick and I had just brought my favorite goat buck in for a second surgery. I was stressed out and upset because I have no other family than my animals. I was telling all this to a cashier at an organic grocer store I shop at. She an I have been friendly for over a year. After listening to me she said it hurt her to see me so sad and she asked me if she could give me a hug. I haven't had a hug from anyone in years so it made me feel like I was cared about by someone in a genuine way. I felt touched and sad at the same time, realizing just how long it had been since anyone showed me a tender act of care.",
"I was recently on the side of the road with a flat tire and a sweet boy stopped and changed my tire for me. I felt really thankful and also know there is still some good in this world.",
"A person who I didn't expect to show sympathy, actually was very upset when I told him about my mother's recent death - he even wrote a note.",
"I was out to dinner at Outback Steakhouse with my family (5 of us). My 3 young kids were being somewhat challenging, and I was a little stressed and not really enjoying my meal.  When we were done, the waiter came to us and said someone at the bar had paid for our meal, tip and everything. We immediately looked up, and no one was there. I was so in shock, confused, and happy....it really made my day.  I posted about it on Facebook and thanked the stranger who paid for our meal, and promised to pay it forward. I received a lot of positive feedback and comments from people.",
"My female cousin once unexpectedly baked a cake and served me a piece. I felt this was quite unusual since she's normally lazy and never does things like this (for anyone), although the inverse is not quite the same. I enjoyed it and found it unusual (the gesture), but coined it as a random act of kindness from her.",
"I was trying to buy a house and someone offered me the money I needed to put down on the house. I was over joyed and shocked that someone would help me in that.",
"I was in a video store (ok not extremely recently but it is what came to mind) and talking to my daughter about what we could get because I had rent due and was really short on money and it was just a bad time in general.  The next thing I knew a somewhat scruffy-looking guy came up and handed me a five dollar bill and kept walking.  I just stood there in shock for a little bit.  I was a little embarrassed, but is was such a nice thing for somebody to have done.",
"The grocery store where I shop regularly was crowded. I had other important work to do and was short on time. The helper at the grocery store understood my predicament  and helped me pay my grocery bill by opening a new counter. He really made my day!",
"One day, I happened to be in a town quite unfamiliar to me. The people there spoke a different language which I could not understand well. Similarly, they could not understand what I was telling them. I wanted to go to a hotel run by somebody who speaks my language. I knew only my mother tongue besides English. There gathered a number of taxi drivers  around me to take advantage of my miserable situation. Seeing the pathetic condition I was in, a young man stepped forward and asked what the matter was. He spoke in good English. I felt very much relieved and happy. I explained my situation and requested him to help. First he assured me that he was not a con and showed me a chain around his neck to prove that he was a devotee of one of the local Gods. He then called one of the taxi drivers and gave instructions as to where to take me. The taxi took me to a hotel whose owner spoke the same language as mine. I felt greatly grateful to the person who helped me in this difficult situation.",
"A man let me go in front of him at the grocery store when I only had a few items and he had a cart full.  I was very relieved because I had a rowdy toddler with me.  It was very nice of him and I was very appreciative.",
"I was on my way to one of my hardest midterms last year, physics. Unexpectedly, a girl was handing out packets containing snacks and other various test supplies out on campus, which was a really nice.",
"A man I had just met, changed the flat tube in my tire five minutes before the mountain bike race that we were both competing in. He did this without hesitation. Amazing.",
"I just did some groceries. I got some extra snacks and drinks. I saw a homeless senior citizen resting on a bench, and decided on a whim to share my snacks and drinks.",
"I was having a really bad day out of nowhere. My mom showed up to my apartment and brought flowers. She does not even live in the same town as me. It was very thoughtful of her. I felt grateful for her.",
"I always strive for a clean house but rarely get it. Not only did I walk into a clean house after work on my Birthday, but my man also got me the most beautiful flowers! I always want nothing but flowers for my day and this time he came through and then some! It was awesome and made me feel good.",
};
JSONArray values;
void setup(){
  values = new JSONArray();

  for (int i = 0; i < rawKindness.length; i++) {
    JSONArray indicesArray = new JSONArray();
    StringList tempIndexValue = new StringList();
    String[] quote = RiTa.tokenize(rawKindness[i]);//make each quote into an array of words
    
    for(int j=0; j<quote.length; j++){//run through each word in the quote to test for verb matches
      for(int k=0;k<kindverbs.length;k++){//test to see if it matches any of the desired verbs
        String quotedword = quote[j];
        String kindword = kindverbs[k];
        if(quotedword.equals(kindword)){//test to see if it matches any of the desired verbs
          tempIndexValue.append(kindword);//add those index values into a list
        }
      }
    }
    for(int j=0;j<tempIndexValue.size();j++){//the list gets added into a json array
      String indexvalue = tempIndexValue.get(j);
      indicesArray.setString(j,indexvalue);
    }
    String filename = "heart"+i+"copy"+".jpeg";
    images[i] = filename;
    filename = "heart"+i+".jpeg";
    imageAgain[i] = filename;
    JSONObject kindness = new JSONObject();

    kindness.setInt("pg", i+2);
    kindness.setString("kindness", "\""+rawKindness[i]+"\"");
    kindness.setString("image", images[i]);
    kindness.setString("image2", imageAgain[i]);
    kindness.setString("author", id[i]);
    kindness.setJSONArray("indicesToHighlight", indicesArray);

    values.setJSONObject(i, kindness);
  }

  saveJSONArray(values, "data/book_content.json");
}

Here’s the Basil.js!

 
#includepath "~/Documents/;%USERPROFILE%Documents";
#include "basiljs/bundle/basil.js";
// Load a data file containing your book's content. This is expected
// to be located in the "data" folder adjacent to your .indd and .jsx. 
var jsonString = b.loadString("book_content.json");
var jsonData;

//--------------------------------------------------------
function setup() {
  b.canvasMode(b.BLEED);
  // Clear the document at the very start. 
  b.clear (b.doc());

  // Make a Title page. 
  b.fill(0,0,0);
  b.textSize(24);
  b.textFont("Taz","UltraLight"); 
  b.textAlign(Justification.LEFT_ALIGN); 
  b.text("SOMETHING KIND", 72,72,360,36);
  b.noStroke();  // no border around img
  var coverimg = b.image("images/heartCover.jpg",b.width-50,b.height*0.8039,50,b.height-b.height*0.8039);
  coverimg.fit(FitOptions.PROPORTIONALLY);

  
  // Parse the JSON file into the jsonData array
  jsonData = b.JSON.decode( jsonString );
  b.println("Number of elements in JSON: " + jsonData.length);

  b.addPage();
  //b.textAlign(Justification.CENTER_ALIGN, VerticalJustification.CENTER_ALIGN );
  //b.text("Much thanks to Professor Golan Levin for the many all nighters you pulled with us",b.width*0.2,b.height*0.2, b.wdith*0.6, b.height*0.4);

  // Initialize some variables for element placement positions.
  // TIP: units are "points", 72 points = 1 inch.
  var quoteW = b.width/2;
  var quoteH = b.height/1.5;
  var quoteX = b.width/2-quoteW/2; 
  var quoteY = b.height/2-quoteH/2;

  var captionX = 0.2*b.width; 
  var captionY = b.height*0.7058;
  var captionW = b.width*0.6;
  var captionH = 36;

  var imageX = 0; 
  var imageXx = 496/612*b.width;
  var imageY = 453/612*b.height;

   b.println("dedication page");
  // Loop over every element of the book content array
  for (var i = 0; i < jsonData.length; i++) {
    b.println(i);
    // Create the next page. 
    b.addPage();

    // Load an image from the "images" folder inside the data folder;
    var anImageFilename = "images/" + jsonData[i].image;
    var anotherImageFilename= "images/" + jsonData[i].image2;
    /*if(i!=jsonData.length-1){
      anotherImageFilename = "images/" + jsonData[i+1].image2;
    }
    else anotherImageFilename = "images/" + jsonData[i].image2;*/
    var anImage = b.image(anImageFilename, 0, b.height*0.8039, 50, b.height-b.height*0.8039);
    anImage.fit(FitOptions.PROPORTIONALLY);

    b.fill(0);
    b.textSize(16);
    b.textKerning(22);
    b.textFont("Taz","UltraLight"); 
    b.textAlign(Justification.CENTER_ALIGN, VerticalJustification.CENTER_ALIGN );
    b.text(jsonData[i].kindness, quoteX,quoteY,quoteW,quoteH);

    // Create textframes for the "caption" fields
    b.fill(0);
    b.textSize(12);
    b.textFont("Taz","UltraLight"); 
    b.textAlign(Justification.RIGHT_ALIGN, VerticalJustification.CENTER_ALIGN );
    b.text("- "+jsonData[i].author, captionX,captionY,captionW,captionH);

    b.addPage();

    var anImageAgain = b.image(anotherImageFilename,b.width-50,b.height*0.8039,50,b.height-b.height*0.8039);
    anImageAgain.fit(FitOptions.PROPORTIONALLY);

    for(var j=0;j<jsonData[i].indicesToHighlight.length;j++){
      b.println(i+"verb"+j+" "+jsonData[i].indicesToHighlight[j]);
      var fillcolor = b.lerp(200, 50, b.pageCount()/104);
      b.fill(b.random(255,b.pageCount()),b.random(fillcolor+55,fillcolor),b.random(fillcolor+55,fillcolor));
      var tsizing = b.lerp(72,24,b.pageCount()/104);
      b.textFont("Taz","SemiLight"); 
      b.textAlign(Justification.LEFT_ALIGN, VerticalJustification.CENTER_ALIGN );
      b.textSize(b.random(tsizing+20, tsizing-10));
      var tcoordinatey = b.random(b.height*0.1, b.height*0.9);
      var tcoordinatex = (b.random(0,b.width*0.7));
      b.text(jsonData[i].indicesToHighlight[j],tcoordinatex,tcoordinatey, b.width-tcoordinatex, 72);
    }
    

  };

  b.addPage();
  var anotherHeart = b.image("images/heart53copy.jpeg", 0, 526, 50, b.height-b.height*0.8039);
  anotherHeart.fit(FitOptions.PROPORTIONALLY);

  ///////GO & DO PAGE------------------------------
  b.addPage();
  var lastHeart = b.image("images/heart53.jpeg", 526,b.height*0.8039,50,b.height-b.height*0.8039);
  lastHeart.fit(FitOptions.PROPORTIONALLY);
  b.textSize(36);
  b.textFont("Taz","SemiLight"); 
  b.textAlign(Justification.LEFT_ALIGN, VerticalJustification.TOP_ALIGN);
  b.fill(255);
    b.text("DO", 533,528.25,72,72);
  b.fill(0);
    b.text("GO", 452,528.25,72,72);
  b.textSize(34);
  b.textFont("DIN","Regular"); 
  b.text("&", 501,524.5,72,72);

  //last words----------------------
  b.addPage();
  var lastImage = b.image("images/TurkThank.png", 0.2*b.width, 0.2*b.height, 0.6*b.width, 0.4*b.height);
  lastImage.fit(FitOptions.PROPORTIONALLY);
  b.textAlign(Justification.CENTER_ALIGN, VerticalJustification.CENTER_ALIGN );
  b.textSize(10);
  b.text("This book is a computationally compilated and formatted collection of Mechanical Turk Worker responses. Above is an email I recieved from a turker",
    captionX,captionY,captionW,2*captionH);

}

// This makes it all happen:
b.go();