New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details
Socket
Book a DemoSign in
Socket

@qvac/langdetect-text

Package Overview
Dependencies
Maintainers
3
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@qvac/langdetect-text

`@qvac/langdetect-text` is a language detection library for qvac. It provides an interface for detecting the language of a given text, returning either the single most likely language or the top K probable languages.

latest
Source
npmnpm
Version
0.1.2
Version published
Maintainers
3
Created
Source

@qvac/langdetect-text

@qvac/langdetect-text is a language detection library for qvac. It provides an interface for detecting the language of a given text, returning either the single most likely language or the top K probable languages.

Usage

LangDetect Class

LangDetect provides a unified interface for detecting the language of a given text. It integrates seamlessly with other QVAC AI Runtime libraries and classes.

Constructor:

const LangDetect = require("@qvac/langdetect-text");
const langDetect = new LangDetect();

Methods:

  • detectOne(text): Detects the most probable language of the given text.

    const lang = langDetect.detectOne("This is a sample text.");
    console.log(lang); 
    // Output: { code: 'en', language: 'English' }
    
  • detectMultiple(text, topK): Detects the topK probable languages of the given text in descending order of probability.

    const langs = langDetect.detectMultiple("Hola, cómo estás?", 3); 
    // Output: [{ code: 'es', language: 'Spanish', probability: 0.7253999999999999 }, { code: 'la', language: 'Latin', probability: 0.07142857142857142 }, { code: 'pt', language: 'Portuguese', probability: 0.007935714285714284 }]
    

Examples

Detecting Single & Multiple Languages

Below is an example of how LangDetect can be used to detect the language of a given text:

const LangDetect = require("@qvac/langdetect-text");

const langDetect = new LangDetect();

const text = "This is a sample text.";

const lang = langDetect.detectOne(text);
const langs = langDetect.detectMultiple(text, 3);

Development

  • Install dependencies:
npm install
  • Run tests:
npm test

License

This project is licensed under the Apache-2.0 License - see the LICENSE file for details.

For any questions or issues, please open an issue on the GitHub repository.

FAQs

Package last updated on 31 Mar 2026

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts