Socket
Socket
Sign inDemoInstall

detectlanguage

Package Overview
Dependencies
47
Maintainers
1
Versions
11
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.0.2 to 1.0.3

tests/data/detect.array.json

2

package.json
{
"name": "detectlanguage",
"version": "1.0.2",
"version": "1.0.3",
"description": "This is a JavaScript Client Library for the DetectLanguage Service API",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -1,13 +0,13 @@

DetectLanguage JavaScript API
Detect Language API
===
Small convenience library allowing developers to easily interact with the DetectLanguage Service API.
JavaScript wrapper for [DetectLanguage Service](https://detectlanguage.com/).
Offical Website:
[https://detectlanguage.com/](https://detectlanguage.com/)
---
Usage
---
Sample Usage:
### Setup

@@ -18,4 +18,10 @@ var DetectLanguage = require('detectlanguage');

});
var dataSimple = "I love Titanic.";
### Simple Detection
Takes a simple string and detects the language with a list of detections.
###### Request
var dataSimple = "I am a Teapot and a Submarine";
detectLanguage.detect(dataSimple, function(error, result) {

@@ -25,6 +31,25 @@ console.log(JSON.stringify(result));

###### Response
{
data: {
detections: [
{
language: "en",
isReliable: true,
confidence: 7.85
}
]
}
}
### Bulk Detection (Recommended)
Takes an array simple string and detects the language with a list of detections.
###### Request
var dataBulk = [
"I love Titanic.",
"I hate Titanic.",
"I like Titanic."
"I am a Teapot and a Submarine",
"Soy una tetera y un submarino",
"Jeg er en tekande og en ubåd"
]

@@ -35,2 +60,37 @@ detectLanguage.detect(dataBulk, function(error, result) {

###### Response
{
data: {
detections: [
[
{
language: "en",
isReliable: true,
confidence: 7.85
}
],
[
{
language: "es",
isReliable: true,
confidence: 3.75
}
],
[
{
language: "da",
isReliable: true,
confidence: 4.09
}
]
]
}
}
### Supported Languages
Returns the list of supported languages.
###### Request
detectLanguage.languages(function(error, result) {

@@ -40,2 +100,26 @@ console.log(JSON.stringify(result));

###### Response
[
{
code: "ab",
name: "ABKHAZIAN"
},
{
code: "aa",
name: "AFAR"
},
{
code: "af",
name: "AFRIKAANS"
}
...
]
### User Status
Returns information about your account and it's status.
###### Request
detectLanguage.status(function(error, result) {

@@ -45,1 +129,23 @@ console.log(JSON.stringify(result));

###### Response
{
date: "2015-02-21",
requests: 31,
bytes: 429,
plan: "FREE",
plan_expires: null,
daily_requests_limit: 5000,
daily_bytes_limit: 1048576,
status: "ACTIVE"
}
---
Author
---
Peter Andreas Moelgaard ([GitHub](https://github.com/pmoelgaard), [Twitter](https://twitter.com/petermoelgaard))
License
---
Licensed under the Apache License, Version 2.0: [http://www.apache.org/licenses/LICENSE-2.0](http://www.apache.org/licenses/LICENSE-2.0)

@@ -22,3 +22,3 @@ /**

var dataSimple = "I love Titanic.";
var dataSimple = "I am a Teapot and a Submarine";
detectLanguage.detect(dataSimple, function(error, result) {

@@ -29,5 +29,5 @@ console.log(JSON.stringify(result));

var dataBulk = [
"I love Titanic.",
"I hate Titanic.",
"I like Titanic."
"I am a Teapot and a Submarine",
"Soy una tetera y un submarino",
"Jeg er en tekande og en ubåd"
]

@@ -34,0 +34,0 @@ detectLanguage.detect(dataBulk, function(error, result) {

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc