npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@saplingai/sapling-js

v1.0.33

Published

JavaScript library for using the Sapling.ai API.

Downloads

59,238

Readme

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. Sapling's HTML SDK can also be directly imported into HTML pages as JavaScript.

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('I have a apple!')
  .then(function (response) {
    console.log(response.data);
  })

// {
//   edits: [
//     {
//       end: 8,
//       error_type: 'R:DET:ART',
//       general_error_type: 'Grammar',
//       id: '740071c9-8ea3-583d-a86b-7ef80e5fc91e',
//       replacement: 'an',
//       sentence: 'I have a apple',
//       sentence_start: 0,
//       start: 7
//     }
//   ]
// }

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