
Research
/Security News
60 Malicious Ruby Gems Used in Targeted Credential Theft Campaign
A RubyGems malware campaign used 60 malicious packages posing as automation tools to steal credentials from social media and marketing tool users.
langdetect-ts
Advanced tools
Google langdetect for the web platform. Detects 55 languages of of the box. Minimum 1 sentence input for >90% accurracy.
🔬 Fast and precise, platform-independent language detection wasn't availabl for Workers and Browsers - now it is. (
langdetect
only works server-side).
langdetect-ts
:npm/yarn/bun install langdetect-ts
import { detectLanguage, type LangProfile } from "langdetect-ts";
import allLanguages from "langdetect-ts/profiles/all.json";
// de out of 55 candidates
const detectDe = detectLanguage("Hallo, Welt, wie geht es Dir?", allLanguages)
console.log('Should be de:', detectDe)
// en out of 55 candidates
const detectEn = detectLanguage("Hello world! How are you?", allLanguages)
console.log('Should be en:', detectEn)
Minimizing the ensemble of languages results in significantly faster results (60x
faster for 2 language candidates instead of 55 candidates, 2ms per detection instead of 100ms
). It also leads to significantly smaller bundle sizes. Detecting languages using n-grams, as it happens in this library, requires datasets that reflect a languages patterns alongside their frequency probabilities. 55
profiles make up 1 MiB gzipped
, while 2
languages only account for 52 KiB gzipped
.
import { detectLanguage, type LangProfile } from "langdetect-ts";
import de from "langdetect-ts/profiles/de.json";
import en from "langdetect-ts/profiles/en.json";
// de out of 55 candidates
const detectDe = detectLanguage("Hallo, Welt, wie geht es Dir?", [de, en])
console.log('Should be de:', detectDe)
// en out of 55 candidates
const detectEn = detectLanguage("Hello world! How are you?", [de, en])
console.log('Should be en:', detectEn)
FAQs
Google langdetect for the web platform. Detects 55 languages of of the box. Minimum 1 sentence input for >90% accurracy.
We found that langdetect-ts demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
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.
Research
/Security News
A RubyGems malware campaign used 60 malicious packages posing as automation tools to steal credentials from social media and marketing tool users.
Security News
The CNA Scorecard ranks CVE issuers by data completeness, revealing major gaps in patch info and software identifiers across thousands of vulnerabilities.
Research
/Security News
Two npm packages masquerading as WhatsApp developer libraries include a kill switch that deletes all files if the phone number isn’t whitelisted.