Last active
November 16, 2020 00:47
-
-
Save MeetMartin/ec3ff35c4b69d2e12bbb8db41ad109b7 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <html> | |
| <head> | |
| <title>NLP in a browser</title> | |
| <script src='./dist/bundle.js'></script> | |
| <script> | |
| const {containerBootstrap, Nlp, LangEn, fs} = window.nlpjs; | |
| const setupNLP = async corpus => { | |
| const container = containerBootstrap(); | |
| container.register('fs', fs); | |
| container.use(Nlp); | |
| container.use(LangEn); | |
| const nlp = container.get('nlp'); | |
| nlp.settings.autoSave = false; | |
| await nlp.addCorpus(corpus); | |
| nlp.train(); | |
| return nlp; | |
| }; | |
| (async () => { | |
| const nlp = await setupNLP('https://raw.githubusercontent.com/jesus-seijas-sp/nlpjs-examples/master/01.quickstart/02.filecorpus/corpus-en.json'); | |
| })(); | |
| </script> | |
| </head> | |
| <body> | |
| <h1>NLP in a browser</h1> | |
| <div id="chat"></div> | |
| <form id="chatbotForm"> | |
| <input type="text" id="chatInput" /> | |
| <input type="submit" id="chatSubmit" value="send" /> | |
| </form> | |
| </body> | |
| </html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment