aboutsummaryrefslogtreecommitdiff
path: root/app/scripts/search.js
blob: d9fdc71e9969491bcfa75707ba839fb8db30a4a6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
const searchBox = document.getElementById('searchBox');
const natural = require('natural');
const wordnet = new natural.WordNet();

searchBox.addEventListener('keypress', (e) => {
    if (e.keyCode === 13) {
        const word = searchBox.value;
        wordnet.lookup(word, details => {
            console.log(details);
        });
    }
});