@ablanc/reverso-api 中文文档教程
reverso-api
使用 reverso 拼写检查 API 的 node.js 模块。
Table of Contents
Installation
npm install @ablanc/reverso-api
# or with yarn
yarn add @ablanc/reverso-api
Usage
import { checkSpelling } from '@ablanc/reverso-api';
async function test() {
const res = await checkSpelling({ text: 'salut les amis' });
console.log(res);
}
test();
以下是您在调用 checkSpelling
时可以覆盖的属性:
interface Params {
autoReplace?: boolean;
generateSynonyms?: boolean;
getCorrectionDetails?: boolean;
interfaceLanguage?: string;
language?: 'fra' | 'eng';
locale?: string;
origin?: string;
text: string;
}
结果对象应如下所示:
interface Result {
id: string;
language: string;
text: string;
engine: 'Cordial' | 'Ginger';
truncated: boolean;
timeTaken: number;
corrections: Correction[];
sentences: any[];
autoReplacements: any[];
}
interface Correction {
group: string;
type: string;
shortDescription: string;
longDescription: string;
startIndex: number;
endIndex: number;
mistakeText: string;
correctionText: string;
suggestions: Suggestion[];
}
interface Suggestion {
text: string;
}
reverso-api
A node.js module to use reverso spell checking API.
Table of Contents
Installation
npm install @ablanc/reverso-api
# or with yarn
yarn add @ablanc/reverso-api
Usage
import { checkSpelling } from '@ablanc/reverso-api';
async function test() {
const res = await checkSpelling({ text: 'salut les amis' });
console.log(res);
}
test();
Here are the properties you can override when calling checkSpelling
:
interface Params {
autoReplace?: boolean;
generateSynonyms?: boolean;
getCorrectionDetails?: boolean;
interfaceLanguage?: string;
language?: 'fra' | 'eng';
locale?: string;
origin?: string;
text: string;
}
The result object should look like this :
interface Result {
id: string;
language: string;
text: string;
engine: 'Cordial' | 'Ginger';
truncated: boolean;
timeTaken: number;
corrections: Correction[];
sentences: any[];
autoReplacements: any[];
}
interface Correction {
group: string;
type: string;
shortDescription: string;
longDescription: string;
startIndex: number;
endIndex: number;
mistakeText: string;
correctionText: string;
suggestions: Suggestion[];
}
interface Suggestion {
text: string;
}