New issue
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
Issue when writing EOL in stream mode #47
Comments
I don't see what this has to do with byline. You're saying that: var writeStream = fs.createWriteStream(tmpFilePath, {flags: 'w', encoding: 'utf-8'}); followed by: writeStream.write(text + os.EOL); Results in a file without EOL characters. Byline plays no role in that. |
Also you have an inconsistency in your code for the encodings 'utf8' vs 'utf-8'. |
@jahewson sorry, does var stream = byline(fs.createReadStream(self._options.trainFile, { flags: 'r', encoding: 'utf8'})); So I would expect to write down that line so stream.on('data', function(text) { /// read line by line
text=text.toLowerCase()
.replace(/^/gm, '__label__')
.replace(/'/g, " ' ")
.replace(/"/g, '')
.replace(/\./g, ' \. ')
.replace(/,/g, ' \, ')
.replace(/\(/g, ' ( ')
.replace(/\)/g, ' ) ')
.replace(/!/g, ' ! ')
.replace(/\?/g, ' ! ')
.replace(/;/g, ' ')
.replace(/:/g, ' ');
writeStream.write(text + '\n');
}); but this is out writing down a new line... |
Ok, so does this: // ...
stream.on('data', function(text) { /// read line by line
console.log(text)
}); Print only one line to the console? |
@jahewson lines are printed out in the console, but when I write to |
I have an issue when writing a file in stream mode. The
EOL
seems not to be respected when writing a new line.This is the sync version, that works as expected.
while this is the stream mode with
byline
The text was updated successfully, but these errors were encountered: