@hero-page/hero-nlp-reddit

1.0.0 • Public • Published

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

Package Sidebar

Install

npm i @hero-page/hero-nlp-reddit

Weekly Downloads

5

Version

1.0.0

License

MIT

Unpacked Size

33.1 kB

Total Files

16

Last publish

Collaborators

  • hero-page