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

palm-nlp-toolkit

v1.0.0

Published

**palm_toolkit** is a JavaScript module that simplifies various text-related tasks using the Google's PaLM API. This toolkit includes functions for text generation, translation, summarization, sentiment analysis, question answering, and text classificatio

Downloads

16

Readme

palm_toolkit

palm_toolkit is a JavaScript module that simplifies various text-related tasks using the Google's PaLM API. This toolkit includes functions for text generation, translation, summarization, sentiment analysis, question answering, and text classification.

Installation

To use PaLM_NLP_Toolkit in your JavaScript project, you can install it using npm:

npm install palmnlptoolkit

Usage

const palm_toolkit = require('palm_toolkit');

// Example 1: Translate Text
const translatedText = await palm_toolkit.translateText('Hello, world!', 'English', 'French');

// Example 2: Summarize Text
const summary = await palm_toolkit.summarizeText('A long piece of text...', 2);

// Example 3: Analyze Sentiment
const sentimentScore = await palm_toolkit.analyzeSentiment('I am feeling great today!');

// Example 4: Answer Question
const answer = await palm_toolkit.answerQuestion('What is the capital of France?', 'Paris is the capital of France.');

// Example 5: Classify Text
const categories = await palm_toolkit.classifyText('This is a news article about technology.');

console.log('Translated Text:', translatedText);
console.log('Summary:', summary);
console.log('Sentiment Score:', sentimentScore);
console.log('Answer:', answer);
console.log('Categories:', categories);

API Reference

translateText(textToTranslate, sourceLanguage, targetLanguage)

Translates text from one language to another.

  • textToTranslate (string): The text to translate.
  • sourceLanguage (string): The source language of the text.
  • targetLanguage (string): The target language for translation.
  • Returns: A Promise that resolves to the translated text.

summarizeText(inputText, summaryLength)

Summarizes input text into a specified number of sentences.

  • inputText (string): The input text to summarize.
  • summaryLength (number): The number of sentences the summary should contain.
  • Returns: A Promise that resolves to the summarized text.

analyzeSentiment(textToAnalyze)

Analyzes the sentiment of input text and provides a sentiment analysis rating.

  • textToAnalyze (string): The text whose sentiment needs to be analyzed.
  • Returns: A Promise that resolves to the sentiment analysis rating.

answerQuestion(question, contextText)

Answers a question based on context and question text.

  • question (string): The question to be answered.
  • contextText (string): The context text that provides information for answering the question.
  • Returns: A Promise that resolves to the text response.

classifyText(textToClassify)

Classifies input text into predefined categories.

  • textToClassify (string): The text to be classified.
  • Returns: A Promise that resolves to a comma-separated plain text list of categories.

Configuration

Before using the palm_toolkit, make sure to set your API key in the .env file:

PALM_API_KEY=YOUR_API_KEY

License

This project is licensed under the MIT License - see the LICENSE file for details.

Acknowledgments

  • Built using the Google's PaLM API.

Author