aboutsummaryrefslogtreecommitdiff
path: root/app/scripts/search.js
diff options
context:
space:
mode:
authorKumar Priyansh <[email protected]>2020-08-31 00:40:54 +0530
committerKumar Priyansh <[email protected]>2020-08-31 00:40:54 +0530
commitc88c3a21fcb0cfb1aa3e24eb1d4b6d5556e29e3c (patch)
tree63ac888b26bd28d681cec7100a7b580745b5ed3a /app/scripts/search.js
parentc31d8ecdd682a33703cd1539b752210c99bd6f43 (diff)
downloaddictionary-c88c3a21fcb0cfb1aa3e24eb1d4b6d5556e29e3c.tar.xz
dictionary-c88c3a21fcb0cfb1aa3e24eb1d4b6d5556e29e3c.zip
basic search logic
Diffstat (limited to 'app/scripts/search.js')
-rw-r--r--app/scripts/search.js10
1 files changed, 10 insertions, 0 deletions
diff --git a/app/scripts/search.js b/app/scripts/search.js
new file mode 100644
index 0000000..0b1f70f
--- /dev/null
+++ b/app/scripts/search.js
@@ -0,0 +1,10 @@
+const searchBox = document.getElementById('searchBox');
+const natural = require('natural');
+const wordnet = new natural.WordNet();
+
+searchBox.addEventListener('keyup', () => {
+ const word = searchBox.value;
+ wordnet.lookup(word, details => {
+ console.log(details);
+ });
+});