Archive for the ‘Libraries’ Category

It’s not an advanced search, it’s an advanced interface

Friday, November 6th, 2015

The ability to converse with computers has for a long time been the realm of science fiction – 2001 and HAL 9000 (or if you were a child of the 80’s maybe the Knight Industries Two Thousand). In the past few years we’ve started to see speech interaction become much more common thanks to services like Siri on iOS devicesDictation in OS X and Cortana on Windows. When you think that we’re increasingly starting to access the web via mobile devices, all of which have a microphone built in to them, it makes sense that speech should be a natural form of input compared to typing on a tiny keyboard.

Recently browsers have started to allow developers access to the Web Speech API. The Web Speech API is a JavaScript API that allows developers to incorporate speech recognition or provide text to speech features within their web based applications. At the moment, as it’s still relatively experimental so doesn’t have thorough browser support. Currently, Chrome is the only major browser to support this feature.

You may have noticed that when you visit the Google homepage in Chrome there is a microphone in the corner of the search box.

Comparison between Google homepage in Firefox and Chrome

Comparison between Google’s homepage in Firefox and Chrome

Clicking on the microphone allows you to dictate a query to Google, rather than typing in your query. The speech recognition doesn’t happen within the browser. The API takes your speech, sends it to Google for analysis & returns a string of text as to what it has interpreted the speech as. It’s a similar process if you’ve enabled Dictation in OSX, your speech is sent to Apple for analysis (there are options for enabling offline recognition). The need for a third party speech recognition service is one reason why browser support is limited. At the moment there isn’t a universal recognition system that these browsers can point to, the recognition is tied into where ever the browser maker decides the recognition is going to take place.

Faking natural language processing

This is the bit where all those researching natural language processing start to roll their eyes & start laughing at me. This section is called faking it and is a very simplistic approach to natural language processing. It’s by no means perfect, but it will demonstrate what you can quite easily do with hardly any effort.

For this demonstration I’ve built an application to demonstrate the Web Speech API and to see if we can make searching a collection an easier process by using speech and ‘faking’ some natural language processing. I’ve built the application to query Trove using it’s API.

How does this work?

Trove provides a perfect example for searching as it’s all essentially fielded queries. To start with there are all the various zones that can be searched upon (pictures, books, maps etc). In addition to the zones, we can target searches to be limited to fielded data like titles, dates and creators. Compared to a broad search interface like Google’s, our search interfaces are dealing with a limited number of combinations limited to the use of these fields.

In our library catalogues or museum collection searches we typically try to make sense of the multitude of fields by grouping them in a related manner.

Trove advanced search screenshot

This is clear, but still quite complex. I’ve previously presented about the difficulties users can encounter trying to successfully navigate these interfaces. Take a sample search “Paintings by Sidney Nolan between 1946 and 1948”. To successfully submit the search requires the user to select a zone to search (Pictures), entering queries into 3 different sections of the form (once in the creator text field and 2 date entries), and interacting with 2 drop down menus (the creator and selecting a format). It’s not a simple task, however, the search term itself isn’t exactly complex. What if we could programatically break down that query automatically into the components that make up these fields?

  • Paintings
  • Sidney Nolan
  • 1946-1948

This can be achieved by passing the query through a set of filters to match patterns that exist in a term. These filters are known as regular expressions. Let’s take a look at just the way we express dates in English & look at how we can detect these patterns and convert them into a query that the Trove API will understand.

English phrase Regular Expression Trove API speak
in 1993 (in|from) ([1-2][0-9]{3}) date:[1993 TO 1993]
from 1933 (in|from) ([1-2][0-9]{3}) date:[1993 TO 1993]
before 1962 (before|pre) ([1-2][0-9]{3}) date:[* TO 1962]
pre 1918 (before|pre) ([1-2][0-9]{3}) date:[* TO 1918]
after 2001 (after|post) ([1-2][0-9]{3}) date:[2001 TO *]
post 1945 (after|post) ([1-2][0-9]{3}) date:[1945 TO *]
in the 1960s (in|from) the ([1-2][0-9]{2}[0][\’]?[s]) decade:196
from the 1960’s (in|from) the ([1-2][0-9]{2}[0][\’]?[s]) decade:196
between 1932 and 1956 (between|from) ([1-2][0-9]{3}) (and|to) ([1-2][0-9]{3}) date:[1932 TO 1956]
from 1939 to 1945 (between|from) ([1-2][0-9]{3}) (and|to) ([1-2][0-9]{3}) date:[1939 TO 1945]

In regular expressions the pipe character “|” indicates OR. A year can (roughly) be expressed by the first character being a 1 or 2 followed by 3 characters that are between 0 and 9 e.g.: ([1-2][0-9]{3}). By testing for these patterns matching a query, it’s relatively easy to extract date information from our query.

Likewise we can look at the start of the query to look for what type of search a user is looking for: books by, pictures of, sound recordings of, photos by, photos taken by, paintings by, maps made by, braille copy of etc etc. By matching these we can determine the “major zone” a query might be taking place in e.g.: book, picture, map etc and possibly a format that is a subset of these major zones e.g.: art work, sound, audiobook, braille, etc.

In addition to the type of zone to search on, it’s also possible to break down the type of search. The terms of “about” or “by” can indicate that a search for “photos of” is a subject search while a search for “photos by” is searching for a creator.

Let’s take a brief look at some common terms that people might use when asking a question and look at how we can analyse these sentences to turn them into a query that a service like Trove would understand. We would typically ask a question along the lines of:

  • Pictures of Sydney Harbour Bridge
  • Pictures of Sydney Harbour Bridge before 1930
  • Pictures of the Sydney Harbour Bridge between 1985 and 1992
  • Photos of the Sydney Harbour Bridge from the 1920’s
  • Books by J.K. Rowling
  • Audio books of Harry Potter
  • Braille version of Harry Potter and the philosopher’s stone
  • Pictures of Canberra from 1926
  • Pictures taken in 1926 (or Pictures from 1926)
  • Maps of Sydney before 1850
  • Recordings of Hubert Opperman
  • ISBN equals 0747545723

2 methods of input for the price of 1

It’s not just about speech. Remember that not every browser supports speech input. Luckily, since the result returned from the speech recognition service is a string of text, this is identical to what could be typed into a search box. This simplistic natural language processing also works when you type a phrase in English – making this process available to any user using any browser.

Not seeking perfection

This really is a demonstration and only uses a selected portion of possible combinations to query – mostly format and date based. There’s obvious issues of false positives. If you were looking for a book with a title of “Photographs of Sydney”, you would get photographs rather than the book. However, we could display other results and list books with this term as a title in facets. There are ways around this.

Maybe with a bit more refining and experimenting, these techniques could greatly assist in providing a simpler interface for interacting with our collections. Have a play with my Ask Trove application and think about how this concept might be able to be incorporated into other applications.

Forte: the National Library of Australia’s sheet music collection iPad app

Tuesday, March 26th, 2013

A man walks into a reading room, hands over his iPad and says “Hi, my name is Jake and I’ve built this”…

Forte iPad

Let’s go back in time

In March 2011 the National Library placed a dataset of our sheet music collection up at This was to be used as one of the datasets for the LibraryHack competition. The dataset contained around 11,000 items from our sheet music collection, all the metadata, all the details about every page within each piece of sheet music and most importantly references to each image of the digitised page. This was a bit of a handcrafted dataset. Our regular API’s, like the Trove API, will only return information for the “top level” of the item, not the lower level details of every page.

We didn’t quite know what would happen with the dataset & how it would end up being used in the competition. Unfortunately it didn’t really get used in a major way in any of the entries and the dataset sat there gathering electronic dust.

Nearly 12 months later, totally out of the blue, someone walked into the reading rooms at the library, approached the person on the desk (who, as luck would have it was Sarah who was the project manager for our iPhone catalogue app), introduced themselves and said “Hi, my name is Jake & I’ve built this” & showed off what was the first prototype of what went on to become Forte.

At the time Jake was looking for a large dataset to help him solve a problem he was working on. He found our sheet music collection & built a proof of concept that helped him to solve his problem. Jake spent a lot of time at the Library working (and using our free wi-fi) and never realised that we had such an interesting collection. In approaching the library he wanted to find out what we thought. He had taken it as far as he could, but wanted some advice on how to take it further.

Over time, the Library worked with Jake to fine tune the app. The app initially started as an A-Z list of 11,000 items. We broke it up into decade by decade & attempted to show how many items were contained within each decade.  We also added a feature to be able to limit it to display who were the active composers within each time period. One thing we decided quite early on in the discussions was that there was to be no search. This was to be a discovery tool that displayed everything. We wanted people to explore.

The final app really has kept the core of Jake’s initial idea. It was refreshing to see someone outside the Library who was unfamiliar with the collection, navigate it & pull out the meaning of what was important and didn’t have preconceived ideas of how a collection had to be accessed. Likewise it was great being able to work with Jake & get the benefits of how he had approached similar problems within other non-library projects.

In keeping with the initial goals of making the data openly available, the Library has released the source code to the app under an open source license. Others can build upon what we have done.


To me there were three really important lessons to come out of this:

  1. Make your data available.
  2. Don’t expect things to happen immediately
  3. If you can, guide the developer to help them fine tune their product & give them insight into the intricacies of the data.

It was one of those perfect examples of everything falling into place with the right people being in the right place at the right time.

Forte is available now at the AppStore. I’m really excited about the story of how the app came into existence, our team that worked alongside Jake to take his idea & build something that I’m really proud of.  I hope you enjoy discovering our collections.

Flickr Commons turns 5

Thursday, January 17th, 2013

Today Flickr Commons turned 5 years old. The Commons has turned into an incredible resource of over 250,000 images from 56 different libraries, archives, and museums throughout the world. For me, the launch of Flickr Commons heralded what turned out to be a huge turning point for my career.

Flickr Commons allowed me to build my first proper mashup – my Google Streetview Then & Now. This was a bit of a breakthrough moment for me. It was my first demonstration of the power that comes from having interesting photos and associated data that was freely licensed and freely available to be shared through an API so others could do things with it. It made my day when George Oates at Flickr saw it and called me a superstar!

A bit to my surprise, people liked what they saw. I overcame my fear of public speaking and starting talking about what I had done and what could come from sharing and reusing data at conferences. People outside of work took an interest in what I had to say. People were willing to fly me places to listen to what I had to say & to listen to my ideas. Not only that, people referred to what I was doing in their conference papers and blogs. This led to me becoming the first Australian to be named as a Mover & Shaker of the library world by Library Journal. It’s allowed me to become a bit of an experimenter at work and

Along the way, my Commons experiences have introduced me to so many like minded people throughout the world. It’s these connections that can’t be measured by the number of views or comments an image contains.

In 2011 my Commons experience was complete when my work set up our own Commons account. I’m now on the other side trying to get interesting things from our collections out there to see what other clever people do with it. It’s a blast!

Little did I know that way back then that building a mashup at 3am one morning would influence my life and my career. I’m absolutely loving the journey it’s taking me on and can’t wait to see what happens next.

Thanks Flickr for what you’ve created.

Trove WordPress plugin

Monday, July 9th, 2012

One of the fantastic resources in Trove is the digitised newspaper collection. We’ve seen people using the newspapers for research & republishing their findings on their blogs. There’s a couple of issues with this:

  1. If the text that is copied hasn’t been corrected, if it ever gets updated in Trove it won’t get updated on their blogs
  2. Attribution is a bit hit and miss. Depending upon what the person does, they may or may not add a link back to Trove. We all know it’s nice to share the love and provide a link back to the resource where you’ve found something.

To make life easier for people using newspapers in Trove I’ve built a simple WordPress plugin based around the Trove API to allow you to embed the text from a newspaper article within your WordPress blog so that the text will reflect the current state of the text in Trove & it will provide attribution back to Trove. All it takes is three easy steps:

  1. Install the plugin
  2. Get the article ID of the text from the URL (e.g.:  the ID of is 2760597)
  3. Where you would like that article to appear in your post us the following short code [trove newspaper=2760597]

That’s it!

I made up a quick screencast to demonstrate the use of it. I really hope that it’s useful for people. If you have any suggestions for improving it or extending it for other uses within Trove I would love to hear about it.

I have to give a big thanks to Kathryn Greenhill for helping me out with beta testing. This is the first thing I’ve built using the Trove API & the first thing I’ve released back into the WordPress community & it feels pretty good!

Puttin’ on the writs

Thursday, December 16th, 2010

This year we had a bit of fun at the National Library of Australia’s Christmas party with our own little take on copyright law. Thanks to Dereta for all her hard choreography work. It was great fun.