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

semantify

v1.0.1

Published

Extract meaning out of text.

Downloads

117

Readme

semantify

A semantic analysis package for text documents and messages.

semantify is an NPM package designed for performing semantic analysis on text documents and long user messages. It utilizes keyword-based filtering and analysis techniques to gain insights into the content's context, intent, and purpose. This library is ideal for workflow automation scenarios where understanding the meaning behind text is crucial.

By using semantify, you can analyze text data and gain insights into its meaning, intent, and purpose. The package is flexible enough to handle a wide variety of text content and can be used in various workflows to automate text analysis processes.

Getting Started

Install: npm install semantify.

The semantify function (See index.ts) is the core of this library. It takes three parameters:

  1. text_body: The text you want to analyze. This can be a string containing a document, a user message, or any other form of written communication.
  2. keyword_macros: An array of strings defining keyword criteria for analysis. Each string represents a specific keyword macro.
  3. analysis_type: A string specifying the type of analysis to perform. Currently, two analysis types are supported:
    • sentence_percentage: Calculates the percentage of sentences in the text that match the specified keyword macros.
    • top_words: Extracts the top three most frequent words from sentences matching the keyword macros.

Example Usage

import semantify from 'semantify';

const textBody = "This is a text document with some keywords. We are trying to understand the meaning behind it. This sentence should be included. This sentence should be excluded.";
const keywordMacros = ["+keywords +understand -excluded"];

// Perform sentence percentage analysis
const sentencePercentageResults = semantify({
  text_body: textBody,
  keyword_macros: keywordMacros,
  analysis_type: "sentence_percentage",
});

console.log("Sentence Percentage Results:", sentencePercentageResults);

// Perform top words analysis
const topWordsResults = semantify({
  text_body: textBody,
  keyword_macros: keywordMacros,
  analysis_type: "top_words",
});

console.log("Top Words Results:", topWordsResults);

Additional Details

Keyword Macros

Keyword macros are defined using keywords and operators. The "+" operator indicates that the keyword must be present in the text, while "-" indicates that the keyword must be absent.

For example, the keyword macro +keywords, +understand, -excluded will only match sentences containing both "keywords" and "understand" but not "excluded".

Sentence Percentage

The sentence_percentage analysis type calculates the percentage of sentences in the text that match the provided keyword macros.

Each sentence is evaluated against each keyword macro, and the percentage is calculated as the ratio of matching sentences to the total number of sentences.

Top Words

The top_words analysis type extracts the top three most frequent words from sentences that match the keyword macros.

Words are ranked by their frequency in the matching sentences, excluding common filler words and the keywords themselves.

Contributing

Contribution are welcome! Please open an issue or submit a pull request.

License

MIT License