Elasticsearch js plugin for langdetect
npm install elasticsearch-detectlang```
$ npm install elasticsearch-detectlang
`js
'use strict';
const hosts = ['127.0.0.1'];
const elasticsearch = require('elasticsearch');
const esDetectLang = require('elasticsearch-detectlang');
const client = new elasticsearch.Client({
hosts,
plugins: [esDetectLang.plugin],
});
client
.detectLang({ text: 'Hello World' })
.then(console.log)
// => { "languages": [{ "language": "en", "probability": 0.9999955765197549 }] }
`
#### text.
Type: string
The text whose language is to be determined
#### cb
Type: functionnoop`
Default:
Callback function to be called with result. If missing it returns a promise
MIT © Nikhil Srivastava