Inspiration 💡

I recently came across my dad's old legal files and contracts and noticed how absurd and difficult the language was to comprehend; this made me realize how many people around the world face such an issue and consequently end up paying large sums of money to lawyers for them to explain the entire contract or Legal English language.

What it does ⚙️

Therefore, I built Justify.ai. It operates in 2 different modes: single-clause and multi-clause mode. If you have a short snippet of Legal English or 1 clause from a contract, you can simply paste or type it in and click "simplify", and subsequently Justify.ai will generate a simplification of the input in plain English terms which is much easier to understand. On the other hand, if you have an entire contract to be processed through Justify.ai, you can paste it all in with full stops separating each clause, enable the multi-clause mode, and now click the "organize" button. Justify.ai will then destructure your contract and make each clause a separate button, so that whichever particular clause of the contract you want to simplify, you just need to click on the corresponding clause and then you will receive a simplification in a matter of seconds like before.

How I built it 🧱

I used Node.js to communicate to the AI, which was GPT-3, and Express in addition to Browserify to run Node in the browser. I used vanilla HTML and CSS for the front-end, JS for the interactivity and making the API calls. The foundation of the simplification system is a few example Legal English to Plain English conversions I wrote out myself which are then passed along with the new user prompt to the backend AI; there, the AI generates an appropriate simplification, based on the training data/examples it receives, which gets sent back to the front-end. To clarify regarding the example simplifications, this is what they look like:

Legal: Neither party may without the prior written consent of the other, such consent not to be unreasonably withheld, assign or in any way dispose of its rights under this agreement to any third party. Plain: As long as one party doesn't have written consent of the other, which should not be unreasonably refused, they cannot transfer their rights and control of this agreement to any third party.

Legal: The parties shall keep confidential all Confidential Information and not, without the prior written consent of the other party, disclose the Confidential Information to any other party save to the extent required by law. Plain: If one party does not have written consent of the other, they may not share any information that is marked as confidential to any third party, but they can share it if it is required by law.

For multi-clause mode, the entire contract gets passed to a formatting function which separates the clauses by the full-stop separators and then displays all the individual clauses as buttons; when clicked, the inner text of the button gets passed to the 'simplification' function which makes a request to the AI/API, like in single-clause mode.

Challenges I ran into 🚧

One recurring issue I had was with styling div elements since they were frequently not aligning like I wanted. Furthermore, towards the end of development I ran into a roadblock because I needed to call a function inside of the bundled JS file from an HTML script tag which also wasn't working. Another snippet of code I wasn't able to ultimately implement was adding event listeners to all elements under the same classname, so instead I resorted to 'onclick' attributes.

Accomplishments that I'm proud of 🍾

Making a very practical webapp that people can sincerely benefit from and save time and money with. Moreover, I'm proud that I persevered when I thought certain bugs couldn't be fixed, and that I also managed to find solutions to issues that I've even had in the past.

What I learned 🤔

Firstly, I learned a ton from mentors about CSS, UI/UX design, and best practices when it comes to project development and niche things like using Flex over Block. I also learned a lot of tiny tricks for JavaScript like making JS functions global to call them from anywhere even if they're in a bundled file, and I familiarised myself very well with in-built JS methods like substr, given that I needed to do a lot of text formatting and manipulation.

What's next for Justify.ai 🔮

Definitely consistently ameliorating the accuracy of the AI by playing around with settings like temperature and top_p, and adding more features and customizability for clauses. For instance, allowing the user to set their own delimiting character (separator between each clause) in multi-clause mode as well as permit full-contract simplification in one go. I hope to eventually deploy Justify.ai and raise awareness about it so that people can save their own time and money when it comes to creating or understanding contracts and the field of law overall.

Built With

Share this project:

Updates