A duplex stream that detects and translates natural language using IBM Watson.
Download node at nodejs.org and install it, if you haven't already.
npm install watson-translate-stream --save
Watson translate stream uses a duplex stream to manage two text streams between differing natural languages.
class LanguageStream extends Stream.Transformconstructor: ->
LanguageFilter = requirePipe = require# Create a shell process to attach to.cmd = 'telnet'arguments = ['localhost', '3001']process = ChildProcess.spawn# Make a new language filter, and set the egress stream language to# english. In this example, we know what we are speaking (en), and# we don't set the far end language so it can be detected and translated.# To turn off detection, specify both ingress and egress languages.# Supports the current Watson languages (en, es, fr, ko)language = new LanguageFilteringressProcessStream = PipeegressProcessStream = Pipe
Generated by package-json-to-readme