Skip to content

First-of-its-kind intelligent thesaurus that uses AI (GPT-3) to generate suitable synonyms for words and phrases based on the context. In contrast to traditional thesauruses, Lexicon.ai ensures the alternatives always make sense to save you time when improving your writing.

License

StiopaPopa/Lexicon.ai

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Lexicon.ai

First-of-its-kind, 21st Century intelligent thesaurus that uses AI (GPT-3) to generate suitable synonyms for words and phrases based on the context. In contrast to traditional thesauruses, Lexicon.ai ensures the alternatives always make sense to save you time when improving your writing.

Fun fact: I used Lexicon.ai when writing this documentation 😄

🔮 Inspiration

Over the start of this school year, I’ve noticed how several of my high school peers, myself included, struggle with finding synonyms or alternatives to phrases that actually make sense in the specific context. This issue arises whenever you’re writing, for instance, an essay for English, or a research paper for History, and you want to make your writing sound more sophisticated. Traditionally, you look up synonyms for the word or phrase you want to change in an (online) thesaurus, but you soon discover that you either don’t know the majority of the words, or that they completely make no sense in the context of your sentence. Therefore, I built Lexicon.ai, a 21st Century intelligent thesaurus that solves this issue by considering your context and sentence as a whole to suggest alternatives that work, completely revolutionizing today’s standards of thesauruses and word-finders.

⚙️ Functionality

Once you reach the site, you’ll be prompted with a text input-field where you can enter a sentence or portion of a sentence, and wrap the word or phrase you’re looking to change with quotation marks (e.i. Her smile makes her very “likeable”). Subsequently, you can click on the “Generate Alternatives” button or simply the Enter Key and Lexicon.ai will begin analyzing your prompt and searching for suitable alternatives that are guaranteed to make sense in that context. Within 3 seconds, Lexicon.ai will output 3 alternatives to your sentence where the highlighted portion of your sentence has been swapped with another fitting word or phrase. If you don’t like the results, you can enter the same input again and you will always receive unique results every time. Finally, you can click on whichever alternative you prefer the most to copy it to your clipboard and paste it back into your document. Voilà; you’ve just found working synonyms to your phrase or word that are 100% accurate in under 3 seconds, an impossible feat with sites like Thesaurus.com!

🧑‍💻 Development

Since the project predominantly relies on the AI, I designed example prompts to be passed on to the AI when a request is made so that it understands the content and format of the output; it was essentially several example prompts that looked like this: “Input: I found his talk very “insightful” Output: I found his talk very |enlightening| * I found his talk very |illuminating| * I found his talk very |eye-opening|” You will notice that there are vertical lines and asterisks used in the output; this is useful for formatting and presenting the AI output later which is explained below. The core of this project is Node and Express which run the actual server, and there are 3 fundamental components, namely the HTML, CSS, and JavaScript. With the first 2 being relatively straightforward, the JavaScript handles requests to the OpenAI API once the Event Listener for the “Generate Alternatives” button or Enter Key has been triggered. The new user input is appended to the pre-designed prompt examples mentioned earlier, and a request is made to the Davinci model of GPT-3, the most sophisticated one, and passes the combined data (pre-designed prompt examples + new user input). The output, along with other pieces of information from the API like certainty %, is then received in JSON format, from which purely the predicted output is extracted. It then gets passed into a formatting function where each of the vertical lines gets converted into either an opening or closing bold HTML tag ( or ) which later makes the changes made to the original sentence in each new sentence render as bold text to stand out, and the asterisks are used to truncate the entire output into the 3 separate sentences generated. In particular, this would convert the example prompt above into: “I found his talk very enlightening”, “I found his talk very illuminating”, “I found his talk very eye-opening”, where each of these sentences is an individual element in the same array. These are then ultimately displayed individually on the front-end, and each of them are assigned an “onclick” property which calls a copy function that copies the innerText of the element (basically the newly produced sentence) to the clipboard. Another part worth mentioning is that, to ensure I could use the OpenAI Node.js module to actually make requests to the API in the browser, I used a tool called Browserify which creates new, bundled versions of the JS files which allow them to be compiled in the browser.

💻 Tech Stack

  • 🐉 HTML/CSS/JS
  • ☕ Espress.js and Node.js
  • 🦋 OpenAI API (GPT-3)
  • 🌐 Browserify

🧐 What's Next for Lexicon.ai

From here, the next stepping stones in line are definitely the following:

  • Employing multi-selection feature; user can select several separate parts of a sentence to generate synonyms simultaneously for

  • Constantly ameliorating accuracy and reducing the number of recurring mistakes the AI makes

  • Allowing users to select how up to how many alternative sentences they want generated

  • A feature to select the style of the alternatives, like formal, colloquial, maybe even Legal English, etc.

  • Giving users the option to upload files AND providing links to websites to be webscraped → to generate entirely paraphrased versions of the content

  • Filtering length of alternatives

  • Initiating Beta testing

  • Deploying the actual website and releasing it to the general public

Built from scratch in under 24 hours by Steve Mendeleev

About

First-of-its-kind intelligent thesaurus that uses AI (GPT-3) to generate suitable synonyms for words and phrases based on the context. In contrast to traditional thesauruses, Lexicon.ai ensures the alternatives always make sense to save you time when improving your writing.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published