elasticsearch-detectlang

1.0.0 • Public • Published

elasticsearch-detectlang

Elasticsearch js plugin for langdetect module

Install

$ npm install elasticsearch-detectlang

Usage

'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 }] }

API

client.detectLang({ text }, cb)

text.

Type: string

The text whose language is to be determined

cb

Type: function
Default: noop

Callback function to be called with result. If missing it returns a promise

License

MIT © Nikhil Srivastava

Package Sidebar

Install

npm i elasticsearch-detectlang

Weekly Downloads

2

Version

1.0.0

License

MIT

Unpacked Size

2.91 kB

Total Files

4

Last publish

Collaborators

  • niksrc