Security News
tea.xyz Spam Plagues npm and RubyGems Package Registries
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
languagedetect
Advanced tools
Readme
LanguageDetect
is a port of the PEAR::Text_LanguageDetect for node.js.
LanguageDetect can identify 52 human languages from text samples and return confidence scores for each.
This package can be installed via npm as follows
npm install languagedetect --save
const LanguageDetect = require('languagedetect');
const lngDetector = new LanguageDetect();
// OR
// const lngDetector = new (require('languagedetect'));
console.log(lngDetector.detect('This is a test.'));
/*
[ [ 'english', 0.5969230769230769 ],
[ 'hungarian', 0.407948717948718 ],
[ 'latin', 0.39205128205128204 ],
[ 'french', 0.367948717948718 ],
[ 'portuguese', 0.3669230769230769 ],
[ 'estonian', 0.3507692307692307 ],
[ 'latvian', 0.2615384615384615 ],
[ 'spanish', 0.2597435897435898 ],
[ 'slovak', 0.25051282051282053 ],
[ 'dutch', 0.2482051282051282 ],
[ 'lithuanian', 0.2466666666666667 ],
... ]
*/
// Only get the first 2 results
console.log(lngDetector.detect('This is a test.', 2));
/*
[ [ 'english', 0.5969230769230769 ], [ 'hungarian', 0.407948717948718 ] ]
*/
detect(sample, limit)
Detects the closeness of a sample of text to the known languagesgetLanguages()
Returns the list of detectable languagesgetLanguageCount()
Returns the number of languages that the lib can detectsetLanguageType(format)
Sets the language format to be used. Suported values:
iso2
, resulting in two letter language formatiso3
, resulting in three letter language formatnode.js
1000 items processed in 1.277 secs (482 with a score > 0.2)PHP
1000 items processed in 4.835 secs (535 with a score > 0.2)Nicholas Pisarro for his work on PEAR::Text_LanguageDetect
Copyright (c) 2013, Francois-Guillaume Ribreau node@fgribreau.com, Ruslan Zavackiy ruslan@zavackiy.com
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
FAQs
Nodejs language detection library using n-gram
The npm package languagedetect receives a total of 25,186 weekly downloads. As such, languagedetect popularity was classified as popular.
We found that languagedetect demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer 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.
Security News
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
Security News
As cyber threats become more autonomous, AI-powered defenses are crucial for businesses to stay ahead of attackers who can exploit software vulnerabilities at scale.
Security News
UnitedHealth Group disclosed that the ransomware attack on Change Healthcare compromised protected health information for millions in the U.S., with estimated costs to the company expected to reach $1 billion.