The ChatGPT Cheat Sheet: NLP Tasks, Code ...

The ChatGPT Cheat Sheet: NLP Tasks, Code, and Expert Prompting Techniques Explained

Aug 12, 2023

The ChatGPT Cheat Sheet: NLP Tasks, Code, and Expert Prompting Techniques Explained

The ChatGPT Cheat Sheet is a quick reference guide that provides a concise overview of NLP tasks, code, and expert prompting techniques available within the ChatGPT platform. This article will help you efficiently navigate and customize language models using ChatGPT, saving you time and effort.

Table of Contents:

  • NLP Tasks

  • Code

  • Structured Output Styles

  • Unstructured Output Styles

  • Media Types

  • Meta ChatGPT

  • Expert Prompting

1. NLP

Text Generation

Prompt: write an intro paragraph to a mystery novel.

It was a dark and stormy night when the body was found. The small town of Millfield was in shock as the news spread that one of their own, local businessman, had been murdered in cold blood. The police were at a loss for leads and the residents of the town were on edge. But one person, a young and ambitious reporter, was determined to uncover the truth and find the killer. Little did she know, this case would lead her down a treacherous path of lies, deception, and hidden secrets that would shake the very foundations of the town. As she delves deeper into the investigation, she begins to realize that nothing is as it seems and that the killer may be closer than she ever imagined.

Summarization

Prompt: summarize this text: It was a dark and stormy night when the body was found. The small town of Millfield was in shock as the news spread that one of their own, local businessman, had been murdered in cold blood. The police were at a loss for leads and the residents of the town were on edge. But one person, a young and ambitious reporter, was determined to uncover the truth and find the killer. Little did she know, this case would lead her down a treacherous path of lies, deception, and hidden secrets that would shake the very foundations of the town. As she delves deeper into the investigation, she begins to realize that nothing is as it seems and that the killer may be closer than she ever imagined.

A young reporter in a small town investigates the murder of a local businessman and uncovers a web of lies, deception and hidden secrets that shake the foundations of the town. The police have no leads and the town is on edge. The reporter delves deeper into the investigation and realizes the killer may be closer than she imagined.

Open Domain Question Answering

Prompt: when did Apollo 11 land on the moon

Apollo 11 landed on the moon on July 20, 1969.

Paraphrasing

Prompt: rewrite this text: Apollo 11 landed on the moon on July 20, 1969

On July 20, 1969, the Apollo 11 mission successfully landed on the moon.

Sentiment Analysis (few-shot or zero-shot)

Prompt: I like pizza, positive I don't like pizza, negative sometimes, I like pizza sometimes I don't, neutral while the movie was good, I sometimes though it was a bit dry,

neutral

Table to Text

Prompt: summarize the data in this table: I like pizza positive I don't like bananas negative Sometimes I like pizza but sometimes I don't neutral While the movie in general was pretty good, I sometimes thought it was a bit dry neutral

This table contains four statements, two of them express a positive and negative opinion about two different subjects, Pizza and Bananas. Other two statements express a neutral opinion about the same subjects, Pizza and a movie.

Text to Table

Prompt: create a table from this text: create a 2 column table where the first column contains the stock ticker symbol for Apple, Google, Amazon, Meta, and the other column contains the names of the companies.

Token Classification (few-shot or zero-shot)

Prompt: Classify the named entities in this text: George Washington and his troops crossed the Delaware River on December 25, 1776 during the American Revolutionary War.

George Washington: Person

Delaware River: Location

December 25, 1776: Date

American Revolutionary War: Event/War

Dataset Generation (few-shot or zero-shot)

Prompt: generate more datapoints from this text: "contains no wit , only labored gags " 0 (negative) "that loves its characters and communicates something rather beautiful about human nature " 1 (positive) "remains utterly satisfied to remain the same throughout " 0 (negative)

  • "lacks originality and fails to engage the audience" (negative)

  • "offers a refreshing take on the genre and leaves a lasting impact on the viewers" (positive)

  • "fails to deliver a cohesive plot and relies too heavily on cheap humor" (negative)

  • "features compelling performances and a well-written script that keeps the viewers hooked" (positive)

Machine Translation

Prompt: Itranslate this text into Portuguese: welcome to the matrix

Bem-vindo à Matrix.

2. Code

Code Generation

Prompt: show me how to make an http request in Python

Code Explanation

Prompt: explain this python code:

from deepsparse import Pipeline

qa_pipeline = Pipeline.create(task="question-answering")
inference = qa_pipeline(question="What's my name?", context="My name is Snorlax") >> {'score': 0.9947717785835266, 'start': 11, 'end': 18, 'answer': 'Snorlax'}

This Python code uses the deepsparse library to create a pipeline for performing question-answering tasks. Here's what each line does:

  1. from deepsparse import Pipeline: This line imports the Pipeline class from the deepsparse library, which provides an interface for performing various natural language processing tasks.

  2. qa_pipeline = Pipeline.create(task="question-answering"): This line creates a new instance of the Pipeline class with the task set to "question-answering". This means that the pipeline will be optimized for answering questions given a context.

  3. inference = qa_pipeline(question="What's my name?", context="My name is Snorlax"): This line runs the Pipeline instance on a specific input. In this case, the question being asked is "What's my name?" and the context is "My name is Snorlax". The inference variable will contain the output of the pipeline.

  4. {'score': 0.9947717785835266, 'start': 11, 'end': 18, 'answer': 'Snorlax'}: This is the output of the pipeline. It is a dictionary containing several keys:

    • score: A score indicating how confident the pipeline is in its answer. In this case, the score is very high (0.9947717785835266), indicating that the pipeline is very confident in its answer.

    • start: The index of the first character of the answer in the context string. In this case, the answer ("Snorlax") starts at index 11.

    • end: The index of the last character of the answer in the context string. In this case, the answer ends at index 18.

    • answer: The actual answer to the question. In this case, the answer is "Snorlax", which is the name given in the context string.

Docstrings Generation

Prompt: write a docstring description for this function:

import requests

def makegetrequest(url):
response = requests.get(url)
return response.statuscode, response.text

makeget_request('https://www.example.com')

Programming Language Conversion

Prompt: convert this code from Python to ("hello world")

console.log("hello world");

Data Object Conversions (JSON, XML, CSV etc.)

Prompt: Convert this JSON object into XML: {"Name":{"0":"John Smith","1":"Jane Doe","2":"Bob Johnson","3":"Samantha Williams"},"Age":{"0":32,"1":28,"2":45,"3":40},"Gender":{"0":"Male","1":"Female","2":"Male","3":"Female"},"O ccupation":{"0":"Software Developer","1":"Data Analyst","2":"Project Manager","3":"Marketing Director"}}

Knowledge Graph Generation

Prompt: convert this text into nodes and edges: Babe Ruth joined the New York Yankees in 1920. The Boston Red Sox sold his contract to the Yankees. He played for the Yankees from 1920 to 1934, and during that time he established himself as one of the greatest players in baseball history.

Here is an example representation of the text as a graph with nodes and edges:

scssCopy code(Babe Ruth) --joined--> (New York Yankees)
(Boston Red Sox) --sold--> (New York Yankees)
(New York Yankees) --played for--> (1920 - 1934)
(Babe Ruth) --established himself as--> (one of the greatest players in baseball history)

In this representation, each entity (e.g., "Babe Ruth", "New York Yankees") is represented as a node, and each action or relationship between entities is represented as an edge. For example, "Babe Ruth joined the New York Yankees in 1920" is represented by an edge from the "Babe Ruth" node to the "New York Yankees" node, labeled with the word "joined". Similarly, "The Boston Red Sox sold his contract to the Yankees" is represented by an edge from the "Boston Red Sox" node to the "New York Yankees" node, labeled with the word "sold". Finally, "He played for the Yankees from 1920 to 1934" is represented by an edge from the "New York Yankees" node to a new node labeled "1920 - 1934", with a label of "played for". Similarly, "during that time he established himself as one of the greatest players in baseball history" is represented by an edge from the "Babe Ruth" node to a new node labeled "one of the greatest players in baseball history", with a label of "established himself as".

HTML to Text (Web Scraping)

Prompt: convert this HTML to text: '<h1 class="heading1" id="neural-magic-platform-documentation">Neural Magic Platform Documentation</h1>' using python.

3. Structured Output Styles

List

Prompt: give me a list of 5 citrus fruits

Sure, here's a list of 5 citrus fruits:

  1. Orange

  2. Lemon

  3. Lime

  4. Grapefruit

  5. Tangerine

Headings and Subheadings

Prompt: convert this text into headings and subheadings: Babe Ruth joined the New York Yankees in 1920. The Boston Red Sox sold his contract to the Yankees. He played for the Yankees from 1920 to 1934, and during that time he established himself as one of the greatest players in baseball history.

Tables

Prompt: create a table from this list: Oranges, Lemons, Limes, Grapefruit, Tangerines

4. Unstructured Output Styles

Narrative Modes (1st, 2nd or in the 3rd person)

Prompt: Write a paragraph on how to make brownies in the 1st person

Sure, here are the ingredients and step-by-step instructions for making brownies:

Ingredients:

  • 1/2 cup unsalted butter

  • 1 cup semi-sweet chocolate chips

  • 1 cup granulated sugar

  • 2 large eggs

  • 1 teaspoon vanilla extract

  • 1/2 cup all-purpose flour

  • 1/4 cup unsweetened cocoa powder

  • 1/4 teaspoon salt

Instructions:

  1. Preheat the oven to 350°F (175°C) and grease a 9x9 inch baking pan.

  2. In a saucepan over low heat, melt the butter and chocolate chips together, stirring constantly until smooth. Remove from heat and let cool for a few minutes.

  3. In a mixing bowl, whisk together the sugar, eggs, and vanilla extract until the mixture is light and fluffy.

  4. Add the chocolate mixture to the mixing bowl and stir until well combined.

  5. Add the flour, cocoa powder, and salt to the mixing bowl and stir until the batter is smooth.

  6. Pour the batter into the prepared baking pan.

  7. Bake for 25-30 minutes or until a toothpick inserted into the center comes out clean.

  8. Let the brownies cool for a few minutes before cutting and serving. Enjoy!

Formal

Prompt: Write a paragraph on the topic of cellular automata in a formal style

Cellular automata are mathematical models consisting of grids of cells that evolve over time based on a set of rules. These models have been studied extensively in the fields of computer science, physics, and mathematics. Cellular automata have been used to model a wide range of phenomena, such as fluid dynamics, crystal growth, and traffic patterns. They have also been used as a tool for investigating complex systems and emergent behavior. The behavior of cellular automata can be quite complex, even with very simple rules, and this has led to a great deal of interest in studying and understanding these systems. Through the study of cellular automata, researchers have gained insights into the behavior of complex systems and have developed new mathematical techniques for modeling and understanding these systems.

Informal

Prompt: Write a paragraph on the topic of cellular automata in an informal style

Have you ever heard of cellular automata? They're these really cool mathematical models that work by dividing up a grid of cells and then applying rules that determine how each cell evolves over time. The rules can be super simple, but the behavior that emerges from these systems can be incredibly complex and fascinating. Scientists have used cellular automata to model all sorts of stuff, from fluid dynamics to traffic patterns. And even though they're really abstract and mathematical, there's something about the patterns that they create that just draws you in. Plus, they've been used in some pretty creative ways, like to make digital art and music. If you're into math and science, cellular automata are definitely worth checking out!

Personas

Prompt: Write a paragraph on the topic of cellular automata in the style of a social media influencer

OMG guys, have you heard of cellular automata? 🤯 They're seriously mind-blowing mathematical models that create these amazing patterns by applying simple rules to a grid of cells. Like, it's crazy how something so simple can create something so complex and beautiful! 😍 Scientists have used cellular automata to model all sorts of real-world phenomena, like traffic flow and the spread of disease. But the coolest thing is that you can use cellular automata to create all sorts of digital art and music! 🎨🎶 Seriously, if you're looking for some inspiration for your next creative project, check out cellular automata. You won't regret it! 😉 #cellularautomata #mathisbeautiful #digitalart #musicproduction

Custom Text Manipulation

Prompt: Write a paragraph on the history of the calculator, include emojis at the end of every sentence, and do not capitalize the first word in each sentence

🧮 did you know that the calculator has a long and fascinating history? the first calculators were actually abacuses, which have been used for thousands of years to perform simple calculations. ⏹️ the first mechanical calculator was invented in the 17th century, and it wasn't until the 1960s that electronic calculators became widely available. 📈 today, calculators come in all sorts of shapes and sizes, from tiny pocket calculators to powerful scientific calculators that can perform complex calculations in seconds. 🔍 and with the rise of smartphones and other mobile devices, most of us carry a calculator with us wherever we go! 📱 the calculator may seem like a simple tool, but it has a rich and complex history that has shaped the way we think about numbers and calculations. 💭

5. Media Types

Write Social Media Posts

Prompt: Write a tweet on futurism

The future is now! 🔮 As a #futurist, I'm excited to explore the latest trends and technologies that are shaping our world. 🌎 From AI and robotics to biotech and space travel, the possibilities are endless! 🚀 Join me on this journey to discover what lies ahead. #futuretech #innovation

Write Blogs

Prompt: Write a blog on french cuisine

French cuisine is widely regarded as one of the finest in the world, renowned for its exquisite flavors, meticulous attention to detail, and the use of high-quality, fresh ingredients. It is no wonder that the French take their food very seriously and consider it to be an integral part of their cultural identity.

The foundation of French cuisine is based on the principle of "terroir," which refers to the unique characteristics of a particular region, including the climate, soil, and other environmental factors that influence the flavors of the local produce. This emphasis on using locally sourced, seasonal ingredients ensures that French cuisine is constantly evolving and adapting to the changing seasons.

One of the hallmarks of French cuisine is its emphasis on classic techniques and preparations, such as the five "mother sauces" that form the foundation of many French dishes. These sauces, including béchamel, velouté, espagnole, hollandaise, and tomato, are used in a wide range of dishes, from creamy soups and rich stews to delicate seafood and elegant entrées.

French cuisine is also known for its extensive use of herbs and spices, such as thyme, rosemary, tarragon, and bay leaves, which add depth and complexity to many dishes. Garlic, shallots, and onions are also commonly used to add flavor to everything from sauces and soups to sautéed vegetables and meats.

One of the most famous French dishes is the coq au vin, a classic dish made with chicken, red wine, bacon, mushrooms, and onions. The dish is cooked slowly over low heat, allowing the flavors to meld together and create a rich, hearty stew that is perfect for cold winter nights.

Another French classic is the bouillabaisse, a seafood stew that originated in the coastal town of Marseille. The dish typically includes a variety of fish and shellfish, including mussels, clams, and shrimp, along with tomatoes, garlic, and aromatic herbs like fennel and saffron.

French cuisine is also renowned for its baked goods, including croissants, baguettes, and pastries like macarons and éclairs. These delicate treats require a high level of skill and attention to detail to make properly, with many bakers spending years perfecting their techniques.

In addition to its culinary excellence, French cuisine is also known for its emphasis on conviviality and the enjoyment of food and wine with friends and family. In France, mealtime is not just about nourishment but is also seen as a social occasion to be savored and enjoyed.

In conclusion, French cuisine is a true art form, characterized by its emphasis on high-quality ingredients, classic techniques, and an unwavering commitment to culinary excellence. Whether you are savoring a rich beef bourguignon or indulging in a flaky croissant, French cuisine offers a unique and unforgettable culinary experience that is sure to delight the senses.

Write Emails

Prompt: Write an email selling software to corporate executives

Dear [Corporate Executive],

I hope this email finds you well. I am writing to introduce you to our innovative software that can greatly benefit your company's operations.

Our software is designed to streamline your business processes, increase productivity, and improve communication between departments. It is a comprehensive solution that can be customized to fit the specific needs of your organization, from sales and marketing to customer service and logistics.

Our software includes features such as:

  • Automated workflows that reduce manual processes and eliminate errors.

  • Real-time analytics and reporting that provide actionable insights to make informed decisions.

  • Integration with other systems, such as CRM and ERP, for seamless data exchange.

  • Collaboration tools that facilitate communication and project management between teams.

  • Mobile capabilities that allow your employees to work from anywhere, at any time.

Our software has been successfully implemented by many leading corporations, resulting in increased efficiency, cost savings, and improved customer satisfaction. We are confident that it can do the same for your company.

We would be happy to provide you with a demonstration of our software and answer any questions you may have. Please let us know if you are interested in learning more.

Thank you for considering our software. We look forward to hearing back from you soon.


Best regards,

[Your Name]

Write Poems

Prompt: Write a poem about the soul and show rhyme and meter headings.

Write Songs

Prompt: Write a folk song about the sunset show guitar chords.

Write Resumes/Cover Letters

Prompt: Write a software engineer resume

[Full Name]

[Address]

[Phone Number]

[Email]

Objective: Seeking a challenging software engineering position in a dynamic and fast-paced organization, where my technical skills and experience in software design and development can be utilized to contribute to the growth of the company.

Education: Bachelor of Science in Computer Science [Name of University], [City, State] Graduated [Month, Year]

Technical Skills: Programming Languages: Java, Python, C++, JavaScript, HTML/CSS Frameworks: Spring, Hibernate, Django, Flask Database Management Systems: MySQL, Oracle, MongoDB Operating Systems: Windows, Linux Tools: Eclipse, Visual Studio, Git, JIRA, Jenkins

Experience:

Software Engineer [Name of Company], [City, State] [Month, Year] - Present

• Collaborate with cross-functional teams to design, develop, and implement software solutions using Java, Spring, Hibernate, and MySQL

• Analyze and troubleshoot complex software problems, identify root causes, and implement effective solutions

• Maintain and improve existing software applications, ensuring they are scalable, reliable, and secure

• Participate in code reviews and ensure adherence to coding standards and best practices

• Develop and maintain technical documentation for all software applications and systems

• Contribute to the development of software engineering processes and methodologies to improve productivity and efficiency


Software Development Intern [Name of Company], [City, State] [Month, Year] - [Month, Year]


• Assisted in designing, developing, and testing software applications using Java, Spring, and Hibernate

• Worked with senior developers to troubleshoot and debug software issues

• Participated in code reviews and made suggestions for improvements

• Conducted research on new software development tools and technologies to improve team efficiency

Projects:


• Developed a web-based e-commerce platform using Java, Spring, Hibernate, and MySQL, allowing customers to browse and purchase products online

• Built a mobile application using Java and Android Studio, allowing users to track their fitness goals and progress

• Created a web-based project management tool using Django and MySQL, allowing teams to collaborate on tasks and projects

Certifications:


• Oracle Certified Professional, Java SE 8 Programmer

• AWS Certified Solutions Architect - Associate

References:

Available upon request.

6. Meta ChatGPT

Ask ChatGPT About Its Own Capabilities

Prompt: what ways can you structure text output?

There are many ways to structure text output, depending on the context and purpose of the output. Here are some common ways to structure text output:

  1. Paragraphs: This is the most common way to structure text, where sentences and phrases are arranged in blocks of text that are separated by a blank line. Paragraphs are often used in articles, essays, reports, and other types of written content.

  2. Lists: Lists are useful for presenting information in a structured and easy-to-read format. There are two types of lists: ordered (numbered) and unordered (bulleted). Lists can be used for presenting items, steps, or instructions.

  3. Tables: Tables are useful for presenting data in a structured format, where information is organized into rows and columns. Tables are commonly used in reports, presentations, and data analysis.

  4. Headings: Headings are used to organize text into sections and sub-sections. Headings can be formatted using different styles and sizes to indicate the hierarchy of the content.

  5. Charts and Graphs: Charts and graphs are used to represent data visually, making it easier to understand and analyze. Charts and graphs can be used to show trends, comparisons, and relationships between data points.

  6. Infographics: Infographics are a combination of text, graphics, and charts that are used to convey complex information in a visually appealing and easy-to-understand format. Infographics are often used in marketing, social media, and educational materials.

These are just a few examples of ways to structure text output. The structure you choose will depend on the type of content you are creating and the message you want to convey.

Ask ChatGPT to Expand on Answers

7. Expert Prompting

Prompt ChatGPT with Simultaneous Conditions

Prompt: Write a paragraph on machine learning, in the 1st person, with emojis, with headings and subheadings

🤖 Hi there! I'm excited to talk to you about machine learning.

🧠 Machine learning is a type of artificial intelligence (AI) that allows systems to learn and improve from experience without being explicitly programmed.

📈 It is used in a wide range of applications, such as image recognition, natural language processing, and predictive analytics.

🤖 Here's a breakdown of the different types of machine learning:

1. Supervised Learning

● 🏫 In this type of learning, the model is trained on a labeled dataset, where the correct output is already known.

● 💻 Common examples include identifying objects in images or spam emails.

2. Unsupervised Learning

● In this type of learning, the model is not given any labeled data and must find patterns and relationships on its own.

● 🤖 Common examples include clustering data or identifying patterns in customer behavior.

3. Reinforcement Learning

● 🎮 In this type of learning, the model is rewarded for certain actions and learns through trial and error.

● 🤖 This is often used in gaming and robotics.

🤖 I hope this gives you a better understanding of machine learning and its different types! Let me know if you have any questions.

¿Te gusta esta publicación?

Comprar AI Central un café

Más de AI Central