Swansea Science Festival Chatbot
Over the weekend of 5th and 6th November, the Legal Innovation Lab Wales took part in the Swansea Science Festival, an annual research event hosted by Swansea University, showcasing research being undertaken at the University.
In continuation of the Lab’s work earlier this year at our Legal Hackathon Wales and in line with the Welsh Government’s ongoing programme to improve accessibility of legislation, we created a prototype chatbot for the Science Festival, to be used to answer questions about the Renting Homes (Wales) Act 2016.
We decided to build a chatbot focused on the Renting Homes (Wales) Act 2016 as the Act came into force in December of this year, with large changes to housing law in Wales. The changes included greater protection for contract-holders, clearer rules on occupation contracts, and simplified contractual schemes. We felt a chatbot would provide the best means for users to interact with the legislation as it would allow them to ask questions in natural language and receive relevant answers directly from the provisions of the Act.
To create the chatbot we first had to convert the Act into a computer readable format, by identifying key elements of the text, such as the title, date, sections, paragraphs and keywords. This was carried out using a specific legal Extensible Markup Language called Akoma Ntoso. Once the Act had been converted into an Akoma Ntoso file, we then parsed the file to automatically extract the relevant elements of the Act, i.e. each section, sub-section, paragraph and sub-paragraph, which would eventually become the ‘answers’ that the chatbot would provide to users’ questions. We then used natural language processing (NLP) techniques to generate questions from the ‘answers’ provided by the Act and, using models trained on millions of documents, we created a catalogue of questions and answers for the Act. This catalogue was then used as a ‘script’ for Microsoft’s Power Virtual Agent chatbot, whereby artificial intelligence and NLP was used to take the generated questions as trigger phrases for the connected answer. These trigger phrases, and any input from the user using the same or similar language to the trigger phrases, will ‘trigger’ the chatbot and provide the answer connected to the trigger phrase.
Further details on how the chatbot was produced can be found on the graphic below.
When used in practice during the Science Festival, the chatbot was effective at providing answers to more basic or very specific questions about the provisions of the Act, so long as the questions posed to it were similar to the NLP generated questions. When given more general questions or situation specific questions posed the chatbot struggled to provide answers, but, seeing as the chatbot was based solely on the provisions of the Act, this is to be expected.
Overall, it was interesting to demonstrate LegalTech to the public and in general most people gave a positive response to the use of technology in law and seemed excited to see where developments in LegalTech could lead. We are looking forward to developing our chatbot protype further in the near future.
You may also be interested in our blogs on the team challenges at the Legal Hackathon Wales. Read them here: