Movie Recommender

From UBC Wiki

What is the problem?

We are going to build a movie recommender system that can parse natural language queries like “what is a movie about revenge that was released in the 2010s?” and “recommend me a film directed by Martin Scorsese starring Leonardo DiCaprio.” The program will return a movie that satisfies the constraints, i.e. its title, director, and year it came out. If there are no results that match that exact query, it will state this and then return results that match some of them (e.g. a movie about revenge, but released in 1994).

What is the something extra?

For the something extra, we’re going to utilize TMDb’s APIs in order to get the results for the natural-language Prolog queries. In Prolog, we’ll use a HTTP client to make the GET requests, parse the JSON responses, and return the result to the user in a human readable format.

What did we learn doing this?

Overall, Prolog was a strong fit for this sort or problem, given our limited scope (only allowing questions that fit into one API endpoint). Adding new term types after our initial structure was in place was done with ease, and we were able to construct more complex queries than we had originally expected.

However, there were a few aspects of Prolog that interfered with development:

Leniency of Prolog’s syntax (negative): We were experiencing unexpected behavior because of minor syntax errors that Prolog did not point out. For example, if we had a period before the :- of a conditional predicate, Prolog wouldn’t raise an error and instead would accept incorrect values when we’d expect the predicate to return false. This was difficult for us to debug because we weren’t expecting something like “mp(A,B,C). :- number(B).” to be valid Prolog syntax. Now that we know this can happen, we can be better Prolog debuggers by looking for minor syntactic errors but this makes us feel that Prolog projects can be difficult to maintain.

Working with APIs in Prolog: In terms of parsing information to/from the actual API calls, Prolog was not an ideal language. For example, we wanted to support multiple values to a single query param, ie (with_people=123,456), but this is not straight-forward in Prolog, as working with complex types (ie, dictionary), is difficult, so we had to put more effort into our constraint-->query_param mapping than we’d like to.

Links to code, etc