1.0.32 • Published 1 month ago

@saplingai/sapling-js v1.0.32

Weekly downloads
-
License
Apache-2.0
Repository
github
Last release
1 month ago

sapling-js

Node.js client for the Sapling.ai API.

Try out a grammar check demo. Compare against grammar checking tools and APIs like Grammarly (Grammerly), LanguageTool, ProWritingAid and Ginger.

Functionality

Sapling is an AI messaging assistant. The API currently offers spelling and grammar checking endpoints.

Benefits include:

  • 60% more grammar corrections: compared to other systems at similar accuracy using state-of-the-art machine learning systems for natural language processing.
  • Low Latency: Achieve the same real-time performance that users of Sapling's own interface experience.
  • Over 20 error types: Error categories such as preposition, noun form, and verb tense, including both high-level and fine-grained error information.
  • Custom Models: Get corrections and edits tuned to the domain of your text—for example academic writing vs. subtitles.
  • Enterprise Security: Contact us for our no data retention policies, self-hosted/on-premises deployment options, and other cybersecurity policies and procedures.
  • Rich Text Editor Support: TinyMCE, CKEditor, QuillJS, Trix, ProseMirror, WordPress, Draft.js, Froala, Lexical and others. Consider using Sapling's JavaScript SDK for displaying the API's outputs on webpage editors.

Node.js

sapling-js can be run in a Node.js server or script environment.

See this folder for an example of grammar checking without UI.

React

sapling-js can be imported directly into a React project.

See this React App for a React demo app.

Angular

sapling-js provides Angular support.

See this Angular App for an Angular demo app.

Typescript

sapling-js provides Typescript declarations and can be imported directly into a Typescript project.

See this Typescript App for a Typescript demo app.


Installation

npm install @saplingai/sapling-js

  • Register for an account at Sapling.ai.
  • After registering and signing in, generate a development API key in your dashboard.

Quickstart - Backend

import { Client } from "@saplingai/sapling-js/client";

const apiKey = '<YOUR_API_KEY>';
const client = new Client(apiKey);
client
  .edits('Lets get started!')
  .then(function (response) {
    console.log(response.data);
  })

Quickstart - Frontend

The SDK provides a way to automatically apply edit suggestions to any HTML contenteditable and textarea elements.

Do not serve a page like this publicly, as it exposes the API key. See documentation Deploying to Production for an example of setting up the API key with a separate backend environment.

import { useEffect } from 'react';
import { Sapling } from "@saplingai/sapling-js/observer";


function App() {
  useEffect(() => {
    Sapling.init({
      key: '<YOUR_API_KEY>',
      endpointHostname: 'https://api.sapling.ai',
      editPathname: '/api/v1/edits',
      statusBadge: true,
      mode: 'dev',
    });

    const editor = document.getElementById('editor');
    Sapling.observe(editor);
  });

  return (
    <div id="editor" sapling-ignore="true" contentEditable="true">
      Lets get started!
    </div>
  );
}

Documentation

1.0.33-beta.1

1 month ago

1.0.33-beta.0

2 months ago

1.0.32

3 months ago

1.0.31

3 months ago

1.0.30

4 months ago

1.0.29

5 months ago

1.0.19

9 months ago

1.0.18

9 months ago

1.0.17

9 months ago

1.0.16

9 months ago

1.0.27-beta.0

6 months ago

1.0.22

8 months ago

1.0.21

8 months ago

1.0.20

8 months ago

1.0.26

7 months ago

1.0.25

7 months ago

1.0.24

8 months ago

1.0.23

8 months ago

1.0.28

6 months ago

1.0.27

6 months ago

1.0.15

9 months ago

1.0.14

9 months ago

1.0.13

10 months ago

1.0.11

12 months ago

1.0.10

12 months ago

1.0.9

1 year ago

1.0.8

1 year ago

1.0.7

2 years ago

1.0.6

2 years ago

1.0.7-beta.0

2 years ago

1.0.5

2 years ago

1.0.4

2 years ago

1.0.2

2 years ago

1.0.3

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago

0.0.5

2 years ago

0.0.4

2 years ago

0.0.3

2 years ago

0.0.2

2 years ago

0.0.1

2 years ago