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

@hero-page/hero-nlp-reddit

v1.0.0

Published

A set of natural language processing functions for generating and optimizing Reddit post content.

Downloads

2

Readme

This entire repository was created completely with AI, using the hero-ai-package-creator, which is open-source, uses GPT-4, and is written & maintained by Sam Chahine ❣️🧞‍♀️

# Hero NLP Reddit

A set of natural language processing functions for generating and optimizing Reddit post content.

## Features

1. **generatePostTitle**: Generates an optimized title for a post by combining keywords and current trends. Takes keywords (string array), trends (string array), and a delimiter (string) as input. Handles the case when input arrays are empty or have special characters, ignores keywords that are very long (more than 100 characters).

2. **detectSpellingErrors**: Detects spelling errors in a given text (string). Returns an object with typo count (number) and misspelled words marked (formatted string). Handles extreme cases such as very long strings, non-Latin characters, and gibberish words. Ignores URLs and Markdown syntax.

3. **analyzePostSentiment**: Analyzes the sentiment of a given post content (string). Returns a sentiment score (number) ranging from -1 (extremely negative) to 1 (extremely positive). Handles extreme cases such as multiple languages, slang, and shortened words, but ignores sarcasm, emojis, and URLs.

4. **countWords**: Counts the number of words in a given post content (string). Returns the word count (number). Takes an optional parameter (boolean) to count words exactly without considering punctuations and ignores the '--' separator used for comments in Reddit.

5. **checkKeywordsDensity**: Checks the keywords density in a given post content (string) for a provided list of keywords (string array). Returns an array of objects with keyword (string), frequency (number), and density (number percentage). Ignores words that are part of a URL, parsed HTML or Markdown, and considers different forms of the keyword (case-insensitive).

6. **replaceAllOccurrences**: Replaces all occurrences of a specified string or keyword (string) in the given post content (string) with another string (string). Returns the modified content (string). Handles edge cases such as empty strings or non-string inputs, and ignores matches inside URLs, parsed HTML or Markdown.

7. **generateSummary**: Generates a brief summary of a given post content (string) in a specified length (number). Returns the summary (string). Handles long text, bullet points, and numbered lists. Ignores quotes, code blocks, and items within brackets. Supports multilingual content and markdown syntax.

8. **splitTextIntoParagraphs**: Splits a given post content (string) into paragraphs using specified delimiter (string) and returns the paragraphs (string array). Removes empty paragraphs, handles multiline strings, and ignores content within quotes, Markdown structures, and code blocks. Respects the original formatting for lists and tables.

## Author

[Sam Chahine](https://github.com/kingmeers), at [Hero](https://hero.page)

Tests for analyzePostSentiment

analyzePostSentiment

Tests for generatePostTitle

generatePostTitle

Tests for replaceAllOccurrences

replaceAllOccurrences

Tests for countWords

countWords

Tests for checkKeywordsDensity

checkKeywordsDensity

Tests for detectSpellingErrors

detectSpellingErrors