OER.ai

← Text Compression (You Can Say That Again!)

Grades 2–3 reading level

Text Compression (You Can Say That Again!)

Adapted with AI from the original open resource by CS Unplugged. Nothing is invented — only the reading level changes.

Activity 3: You Can Say That Again! — Text Compression

What This Is About

Computers can only hold so much information. So computers need to be smart about how they store information. This is called compression. Compression means making information smaller.

Here's how it works: the computer changes the information into a shorter code before storing it. This is called coding. When the computer needs the information again, it changes the code back. This is called decoding. This way, the computer can store more, and can send information faster over the internet.

What You Will Learn

  • English: Finding patterns in words and text.
  • Technology: Learning how computers work.

What You'll Need

  • A big poem called "The Rain" to look at as a class
  • Worksheets: "You Can Say That Again!", "Extras for Experts", "Short and Sweet", and "Extras for Real Experts"

Getting Started

Computers store and send lots of data (information). To save space, and to send information fast, computers squeeze the text down. Let's see how.

Look at the poem "The Rain":

Pitter patter
Pitter patter
Listen to the rain
Pitter patter
Pitter patter
On the window pane

Look for letters or words that repeat. Can you find groups of two or more letters that show up again? What about whole words or phrases? We can draw boxes around the repeated parts, and draw arrows back to where they first appeared. That way, we only write each part once!

Worksheet: You Can Say That Again!

Some words and letters are missing from this poem. Can you fill them in? Look at the box the arrow points to — that tells you what letters go there.

After that, pick a poem or nursery rhyme you know. Make your own puzzle like this one! Remember:

  • Arrows must always point back to something earlier in the poem.
  • People should be able to read your puzzle from left to right, top to bottom — just like normal reading.

Challenge: Try to keep as few original words as you can!

Some poems you could try: Three Blind Mice, Mary Mary Quite Contrary, Hickory Dickory Dock — or a Dr. Seuss book!

Hint: Don't crowd your arrows together. Leave space around your letters and words so you have room to draw boxes and arrows. It helps to write the whole poem out first. Then decide where to add boxes.

Worksheet: Extra for Experts

Try solving this puzzle:

Ban---

Sometimes, the missing letters point back to part of the same word! You can still solve it — just copy the letters in order from left to right. Each letter becomes ready to copy again once it's been written. This trick helps computers when the same letter or pattern shows up again and again in a row.

Try making some of your own!

On computers, boxes and arrows are shown using numbers instead. For example, the word "Banana" can be written as:

Ban(2,3)

The "2" means: count back two letters to find where to start copying.

Ban---

The "3" means: copy three letters in a row from there.

Bana--
Banan-
Banana

Since it takes two numbers to code a word this way, it only helps to compress groups of two or more letters. If you used two numbers to replace just one letter, the file would actually get bigger, not smaller!

Try writing your own words the way a computer would compress them. Can your friends figure out what they say?

Worksheet: Short and Sweet

How many words do you really need?

Pretend you are a computer trying to save as much space as possible. Cross out every group of two or more letters that has already shown up earlier in the poem. Once letters have appeared once, they don't need to be written again — a pointer could replace them. Try to cross out as many letters as you can!

I know an old lady who swallowed a bird
How absurd! She swallowed a bird!
She swallowed the bird to catch the spider
That wriggled and jiggled and tickled inside her
She swallowed the spider to catch the fly
I don't know why she swallowed a fly
Perhaps she'll die…

Worksheet: Extra for Real Experts

Ready for a really tough challenge?

A computer program checked this story and found that at least 1,633 letters could be crossed out! Remember, you can only cross out groups of two or more repeated letters. How many can you find?

(The story "The Three Little Pigs" appears here, unchanged, for the compression exercise.)

What's It All About?

Computer storage has grown incredibly fast. In the last 25 years, computers can now store about a million times more than before! But we keep finding new things to store — whole books, libraries, music, and movies. Big files are tricky on the internet too, because they take a long time to download (transfer to your computer). Even small devices like phones and watches need to store lots of information.

Luckily, there's a solution: instead of buying more storage space, we can compress the data to make it smaller. Computers usually do this automatically. We might just notice the disk holds more, or web pages load faster — but really, the computer is working hard behind the scenes!

Many kinds of compression have been invented. The method in this activity — pointing back to earlier parts of the text — is called Ziv-Lempel coding, or LZ coding. It was invented by two scientists in Israel in the 1970s. It works for any language and can often make data half its original size. You may know it as "zip" on computers. It's also used for pictures (called "GIF" images) and for fast internet connections, helping them send data quicker over phone lines.

Other compression methods work differently. They give shorter codes to letters that are used more often. Morse code (a system of dots and dashes) uses this same idea!

Answer Key

You Can Say That Again! (page 26):

Pease porridge hot,
Pease porridge cold,
Pease porridge in the pot,
Nine days old.

Some like it hot,
Some like it cold,
Some like it in the pot,
Nine days old.

Original licensed under CC BY-NC-SA 4.0. This adaptation is provided free by OER.ai.