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

textsmart

v1.0.0

Published

Javascript library for interpreting and classifying binary and text inputs with machine learning from Zayie.

Downloads

2

Readme

TextSmart

A Javascript library from Zayie for interpreting and classifying binary and text inputs with machine learning, sorting, ngrams, probability and other engines working together.

Installation

To use TS.JS, you'll need to install via source or using a package manager like NPM, Github NPM, Apt or Yarn.

gh repo clone Zayie/TextSmart
git clone https://github.com/zayie/textsmart

npm install textsmart
apt-get install textsmart
yarn install textsmart

Initalization

Once you've installed the library and sourced it in your code, just like this. (Use whatever variable you want.)

const TextSmart = require('textsmart');
const tsjs = new TextSmart.Classifier();

Usage

Training

You can train your model to understand what goes where, for example, let's make a classifier that sees if text is informational or social, these examples are from me, Wikipedia and random Twitter posts.


tsjs.train("Issac nueton was born in Philidelphia, USA on March 20th during the first world war. He has many acomplishments, like inventing music.", "smart");

tsjs.train("Just dyed my hair blonde, ya'll fw it or nah. Todays gonna be a rich day, I hope ya'll can find peace and love, praying for everyone!", "social");

tsjs.train("When thinking about possible strategies to make the hypososis iniate conduction, consider the following:", "smart");

// Twitter - @kokoa_garden
tsjs.train("3K+ YEYY!!! ITS FINALLY READY TYSM GUYS FOR ALL THE SUPPORT IT MAKES ME INCREDIBLE HAPPY! As a special for the 3k I'll do a little artist support to share my clout with you So drop your art here and a little presentation of yourself and ill rt/like/follow some. :)", "social");

tsjs.train("Kaja Kallas (born 18 June 1977) is an Estonian politician and the current Prime Minister of Estonia. Sworn in on 26 January 2021, she is the first woman to serve in the position.", "smart");

// Twitter - @BernSoto
tsjs.train("My cousin lives near the NYC Line Friends store and shipped me all these goodies. I'm so happy #bts #BT21", "social");

tsjs.train("Young Kwok Corky Lee (1947 – January 27, 2021) was an American journalistic photographer. His work chronicled and explored the diversity and nuances of Asian American culture overlooked by mainstream media, and advocated for ensuring Asian American history was included as a part of American history.", "smart");

// Twitter - @SugarPineNW
tsjs.train("I could honestly write a movie about what happened the past few days and make millions lmao, I didn’t see any of this coming and it’s such a total mindfuck! I’m glad it ended how it did, I wouldn’t have it any other way", "social");

tsjs.train("Lego System A/S (trade name: The Lego Group) is a Danish toy production company based in Billund.[5] It is best known for the manufacture of Lego-brand toys, consisting mostly of interlocking plastic bricks. The Lego Group has also built several amusement parks around the world, each known as Legoland, and operates numerous retail stores.", "smart");

Parsing

Now we can test it using the tsjs.predict() meathod, the expected outputs are below with the real responses! You can test this demo at this link (in the zayie.net sandbox) or see the full code in examples/socialOrSmart.js

// Text Scrap #1
// Twitter - @ciaraturnerart

console.log(JSON.stringify(tsjs.predict("if u want to draw something silly n small for yourself do it.  you don’t have to constantly pump out perfect completed pieces of art. some of my favorite pieces of art i’ve made are 10 minute doodles")));

// Text Scrap #2
// IMDB - Taylor Swift

console.log(JSON.stringify(tsjs.predict("Taylor Alison Swift is a multi-Grammy award-winning American singer/songwriter who, in 2010 at the age of 20, became the youngest artist in history to win the Grammy Award for Album of the Year. In 2011 Swift was named Billboard's Woman of the Year.")));

Results

// Text Scrap #1

What we wanted - Social
What we got    - Social (21.55%)

// Text Scrap #2

What we wanted - Smart
What we got    - Smart (59.13%)

The system hit the nail on the head on this one with only 4 scraps for each type, you can add dozens, hundreds or even millions (if you can handle it) of examples into the dictionary in order to get the most optimal results.

Footnotes

Improvements, controbutions, and editors are welcome! Email [email protected] for more information.