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

textbuddy

v0.1.12

Published

TextBuddy is a JavaScript module for text analyzis. TextBuddy can assist you with a wide range of tasks - from simple character and word count to chatbot integration with OpenAi's API.

Downloads

46

Readme

⚠️ Warning

This is a new module under active development. It is adviced to wait until version 1.0.0 before using this package in a production enviromment.

See Known issues for more information.

TextBuddy

TextBuddy is a JavaScript module for text analyzis. TextBuddy can assist you with a wide range of tasks - from simple character and word count to chatbot integration with OpenAi's API.

It was created and is maintained by a student at Linnaeus University in Sweden as part of an assignment in the course "Introduction to software quality".

Once the module reaches version 1.0.0, it will be suitable for use by any project that needs a simple, dependency-free, and modern module for analyzing text.

Table of contents

Example usage

const text = new TextBuddy('This is a text in English. It consists of eleven words.')
const wordCount = text.wordCount() // Output: 11

text.setOpenAiApiKey('your-api-key')

try {  
    const language = await text.aiGetLanguage() // Output: en  
} catch (error) {
      console.log(error.message)
}

TextBuddy web application

The TextBuddy javascript module is the engine driving a TextBuddy web application where users can get instant insights about their text.

The TextBuddy web application and TextBuddy javascript module are both part of a student project, but are completely stand alone projects.

The TextBuddy web application is an product implementation of the TextBuddy javascript module. The javascript module by itself does not have any frontend, and can be used in any type of project.

The web application can be seen as one example of what the javascript module is capable of.

TextBuddy web application: https://textbuddy.aihonen.se
Repository for web application: https://github.com/ta223dh/TextBuddy-Application

Getting started

Using the module:

  • Installation: npm i textbuddy

Developing the module:

  • git clone the project repo to your local folder
  • cd TextBuddy to navigage into the folder
  • npm install to install eslint for code standard and ava for unit tests
  • code . to open the project in your code editor
  • Unit tests: npm run test
  • Check lint issues: npm run lint
  • Automatically fix lint issues (if possible): npm run lint:fix

Component code: src/TextBuddy/textbuddy.js

Unit tests: src/tests/textbuddy.test.js

  • Set your API key in Test11 to test the Ai features.

Dependencies

Basic features:

  • TextBuddy is created from the ground up without any dependency on external libraries. The code is all written in modern javascript.

Chatbot integration:

  • Provide your own API key, and TextBuddy will be able to utilize OpenAi's API for chat completion. This will require a network call to OpenAi's servers. For costs, limitations, and privacy policy, refer to your OpenAI license agreement.

https://platform.openai.com/account/api-keys

Features and documentation

Basic

Ai

Known issues

TextBuddy

  • Handle special characters TB-1
  • The word counter should not count line breaks and tabs as words. TB-2

Version history

See version history

Test reports

See test reports

Do you want to contribute to the project?

Create an issue on github to report a bug or suggest a new feature. Make a Pull request to contribute new code. Check the issue list to see if there already is an existing issue before creating a new one.

Bug report:

  • Explain the steps to reproduce, actual behaviour and expected behaviour
  • Module version (for example TextBuddy 0.0.12)
  • Environment (for example Nodejs 18.18.0 LTS or Firefox 118.0).

Feature request:

  • Explain the feature, expected input and output, and why it is needed.

Pull requests:

For code contributions, the following requirements must be fullfilled:

  • Feature or bug has been described in an existing issue
  • Code is documented with JSDoc
  • Code is using modern javascript syntax (ECMAScript 6 and later)
  • No dependencies on third party modules
  • Unit tests are added for the new feature
  • Unit tests (new and old) run with 0 failures
  • Linting runs with 0 warnings

A code review will then be conducted by the repository owner before merging.