We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Im trying to make a chat bot but I keep getting an error when I try and start it so it will learn
Code:
const fs = require('fs') const readline = require('readline') const brain = require('brain.js') const net = new brain.recurrent.LSTM() const rl = readline.createInterface({ input: process.stdin, output: process.stdout }) const array = [] fs.readFile('learned.json', (err, data) => { if(err) return console.log(err) if(data.toString() === '') { console.log('Network already trained.') train() } else { net.fromJSON(JSON.parse(data.toString())) boot() } }) const train = () => { console.log('Training...') const d = new Date() fs.readFile('essay.txt', (err, data) => { array = data.toString().split('.') net.train(array, { iterations: 20000, log: true, errorThresh: 0.01 }) fs.writeFile('learned.JSON', JSON.stringify(net.toJSON())) console.log(`Training finished in ${(new Date() - d) / 1000} s`) }) } const boot = () => { rl.question('Enter: ', (q) => { console.log(net.run(q)) boot() }) }
The text was updated successfully, but these errors were encountered:
Could you provide a sample of the data from the learned.json file?
learned.json
Sorry, something went wrong.
robertleeplummerjr
No branches or pull requests
Im trying to make a chat bot but I keep getting an error when I try and start it so it will learn
Code:
The text was updated successfully, but these errors were encountered: