Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
opex-yandex-speller
Advanced tools
This package provides a convenient way to interact with the Yandex Speller API for spell checking in Russian, Ukrainian, and English languages.
This package provides a convenient way to interact with the Yandex Speller API for spell checking in Russian, Ukrainian, and English languages.
npm install opex-yandex-speller
You can import the package using ES6 modules or CommonJS require:
// ES6 import
import { YandexSpeller } from 'opex-yandex-speller';
// CommonJS require
const { YandexSpeller } = require('opex-yandex-speller');
YandexSpeller
ClassThe main class for interacting with the Yandex Speller API.
const speller = new YandexSpeller(settings);
settings
(optional): An object with the following properties:
- format
(string): Text format, either 'plain' (default) or 'html'.
- lang
(string): Languages for spell checking, comma-separated. Default: 'en,ru'.
- options
(object): Speller options (see below).
- requestLimit
(number): Maximum number of request attempts. Default: 2.
- timeout
(number): Timeout between request attempts in milliseconds. Default: 500.ignoreDigits
(boolean): Ignore words with numbers, e.g., "avp17h4534".ignoreUrls
(boolean): Ignore URLs, email addresses, and filenames.findRepeatWords
(boolean): Highlight repeated words, e.g., "I flew to to to Cyprus".ignoreCapitalization
(boolean): Ignore incorrect use of capitalization, e.g., "moscow" instead of "Moscow".checkText(text)
Checks the spelling of a given text.
text
(string): The text to check.Example:
const speller = new YandexSpeller();
async function checkSpelling() {
try {
const result = await speller.checkText('testt textt');
console.log(result);
} catch (error) {
console.error('Error:', error.message);
}
}
checkSpelling();
checkTexts(texts)
Checks the spelling of multiple text fragments.
texts
(array of strings): An array of text fragments to check.Example:
const speller = new YandexSpeller();
async function checkMultipleTexts() {
try {
const result = await speller.checkTexts(['testt textt', 'anoter exammple']);
console.log(result);
} catch (error) {
console.error('Error:', error.message);
}
}
checkMultipleTexts();
The API uses the following error codes:
ERROR_UNKNOWN_WORD
(1): Unknown word.ERROR_REPEATED_WORD
(2): Repeated word.ERROR_CAPITALIZATION
(3): Capitalization error.ERROR_TOO_MANY_ERRORS
(4): Too many errors.You can import these constants:
import { ERROR_UNKNOWN_WORD, ERROR_REPEATED_WORD, ERROR_CAPITALIZATION, ERROR_TOO_MANY_ERRORS } from 'opex-yandex-speller';
The API returns an array of error objects. Each error object has the following structure:
code
(number): The error code (see above).pos
(number): The position of the error in the text (0-based).row
(number): The row number of the error (0-based).col
(number): The column number of the error (0-based).len
(number): The length of the erroneous word.word
(string): The word with the error.s
(array of strings): Suggested corrections.Example response:
[
{
code: 1,
pos: 0,
row: 0,
col: 0,
len: 5,
word: "testt",
s: ["test", "tests"]
},
{
code: 1,
pos: 6,
row: 0,
col: 6,
len: 5,
word: "textt",
s: ["text"]
}
]
This package is a wrapper for the Yandex Speller API. Please refer to their documentation for more detailed information about the service.
FAQs
This package provides a convenient way to interact with the Yandex Speller API for spell checking in Russian, Ukrainian, and English languages.
The npm package opex-yandex-speller receives a total of 3 weekly downloads. As such, opex-yandex-speller popularity was classified as not popular.
We found that opex-yandex-speller demonstrated a healthy version release cadence and project activity because the last version was released less than 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
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.