Elasticsearch js plugin for langdetect module
$ npm install elasticsearch-detectlang
'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 }] }
Type: string
The text whose language is to be determined
Type: function
Default: noop
Callback function to be called with result. If missing it returns a promise
MIT © Nikhil Srivastava