DEV Community

Cover image for Finding Books for Prisoners
Isaac Lee
Isaac Lee

Posted on • Originally published at crunchingnumbers.live

Finding Books for Prisoners

I had an interesting night from volunteering at Inside Books Project, the only books-to-prisoners program in Texas. Every month, the volunteers receive about 2,000 letters. For each letter, they find books that the person would enjoy and write a reply.

I started seeing parallels with what I do for work and became intrigued by 3 things: the abundance of math in finding books for prisoners, the absence of order and technology to help me find books, and the heuristics that I ended up using instead.


1. Abundance

The seemingly simple act of mapping a person's letter to their books involves several hard math problems.

First, I need to read and understand the letter. I need to know enough vocabulary, grammar, and idioms so that I can decide words that make up the person's request, words that matter more than others, misspelled words that should be corrected and reconsidered, and so on.

Second, I need access to a database of books. Quite likely, the database keeps track of a book's title, author, publication date, genre, and summary, in addition to the book's availability and approval at Inside Books Project. (A book cannot have a detailed map of Texas, for example.)

Next, I need to create a model that quantifies how well a book matches the person's request. Does the author count more than the genre? Is the book content up-to-date? etc. The model is subjective and needs to be tested. Once I can assign a score to each book, I know which books to send along with my reply letter. 🎉

Not so fast. To break even the postage cost, the books must weigh between 1 lb 10 oz and 1 lb 13 oz total. Now I have a constrained optimization. The rule can be relaxed, though. If an overweight book is an ideal match to a person's request, Inside Books Project will make an exception.

Last but not least, what if two people need the same book and there is only one copy? How do we optimize for a group of people's requests?

2. Absence

As soon as I picked up my first letter, I met interesting challenges. The person asked for books by Jeffery Deaver or authors with a similar writing style. Google told me Jeffery is a crime fiction writer.

When I approached fiction, I discovered that books weren't sorted at all. Some books laid horizontally and some shelves had a hidden layer of books behind. Imagine that. I knew which author and titles to look for, but still couldn't determine if the books were available because they weren't sorted.

To compound the complexity, there was no digital catalog, not even paper. (It would have been nice to see an antique card catalog—you know, the one with small, solemn drawers, each with an inornate, brass handle.)

3. Heuristics

I gave up searching for Jeffery. Time to find other books that the person would enjoy. Since I hadn't read Jeffery's books, I couldn't base my search on his writing style. Instead, I assumed that the person would be okay with books by fellow crime fiction writers, especially if they are well-known. I turned to Google to see if I recognized any of the names. Asking the staff for recommendation also made a good choice.

I had more success with subsequent letters. I noticed that the more alternate requests the person made and the more mutually exclusive these alternatives were (e.g. books on Russian, calculus, or biology), the more easily I found books that the person would like. It makes sense. The more options I consider, the larger the result set will be and the more likely I can find books that also meet the weight constraint.

I also recognized that I was introducing biases when I ranked books. Since I like math, I made sure that the second person would receive calculus. It was quite possible that they had wanted to study Russian more than calculus (as they had listed foreign language first in their letter), but my interests mattered more and simplified the decision of which books to send.

Sometimes, I could read between lines and come up with a new request. For example, one person wanted to read about photography (copyright), wood working, and solar panel. Without context, these have little in common. Since Inside Books Projects is about increasing education and reducing recidivism, I was able to infer that the person wanted to build their career and adjust their books accordingly.

4. Conclusion

As you can tell, I came out of a volunteer opportunity with several insights into building a recommendation system. I got to help several people by sending a personal package and letter, and help myself by learning something unexpectedly. It's always nice to see how math can be applied to everyday life.

I encourage you to find out if there is a books-to-prisoners program like Inside Books Project in your area and lend help today.

Top comments (0)