Comp Sci Answer: Dictionary Compression: Solving the Mystery of "01

  • Thread starter Thread starter Villiers
  • Start date Start date
  • Tags Tags
    Compression
Click For Summary
The discussion clarifies the concept of dictionary compression, specifically how assigning a binary code, such as "01," to frequently used words can significantly reduce data size. For instance, the word "because," which may appear 50 times in a document, can be replaced with a two-bit code, saving 38 bits per occurrence. The conversation highlights a correction regarding the use of bits for indexing, noting that a lookup list for the document's unique words is being created rather than referencing a full dictionary. It emphasizes that this method streamlines storage by replacing lengthy word occurrences with shorter codes. Overall, the approach demonstrates an efficient way to compress data in larger documents.
Villiers
Messages
7
Reaction score
0
Homework Statement
In a text document each letter could be stored as an ASCII code of 8 bits
In this document the word ‘because’ requires 56 bits of data (7 letters x 8 bits)
Instead, the word could be added to a dictionary and assigned the binary code 01 which is a reduction of 38 bits for each occurrence
A saving for 50 occurrences of the word:
Relevant Equations
50 x 54 bits saving = 2,700 bits saved, or 338 bytes
Hi

I have the answer to the dictionary compression question- but can't understand the following in the notes:

Instead, the word could be added to a dictionary and assigned the binary code 01 which is a reduction of 38 bits for each occurrence - what does this mean?

This is the extract in full:
In compressing larger volumes, a document of 100 pages could contain the word ‘because’ 50 times, resulting in 2000 bits of data being required. Instead the word could be added to a dictionary and assigned the code 01 which is a reduction of 38 bits for each occurrence. There would still be a slight overhead in terms of the storage of the dictionary but this would only be a one-off entry per word.
 
Physics news on Phys.org
Words could be assigned a number, which is stored instead of the entire word. Webster's Dictionary contains 470,000 words. That would require 19 bits to give each word a unique number. The explanation you quoted seems to use 18 bits instead of 19 (because 56-38=18). That would allow you to assign unique numbers to ##2^{18} = 262,144## words.

CORRECTION: It looks like it is talking about making a lookup list of only the words in the document, not an entire English language dictionary. So the word ‘because’ is the first word in the lookup list with index 01 and any occurrence of that word in the text is replaced by '01'.
 
Last edited:
thank you for your feedback
 
FactChecker said:
Words could be assigned a number, which is stored instead of the entire word. Webster's Dictionary contains 470,000 words. That would require 19 bits to give each word a unique number. The explanation you quoted seems to use 18 bits instead of 19 (because 56-38=18). That would allow you to assign unique numbers to ##2^{18} = 262,144## words.
I don't think this is what the question means, you are adding in assumptions which I can't see are justified.

Let's have another look:
Villiers said:
In compressing larger volumes, a document of 100 pages could contain the word ‘because’ 50 times, resulting in 2000 bits of data being required.
So each occurrence of 'because' requires 2000 ÷ 50 = 40 bits. This is clearly not ASCII so the calculation 7 x 8 = 56 bits is not relevant.

Villiers said:
Instead the word could be added to a dictionary and assigned the code 01 which is a reduction of 38 bits for each occurrence.
01 is two bits, 40 - 2 = 38.
 
  • Like
Likes FactChecker
pbuk said:
I don't think this is what the question means, you are adding in assumptions which I can't see are justified.
I stand corrected. It looks like it is talking about making a lookup list of only the words in the document, not an entire English language dictionary. So the word ‘because’ is the first word in the lookup list with index 01 and any occurrence of that word in the text is replaced by '01'.
 
Thread 'Why wasn’t gravity included in the potential energy for this problem?'
I’m looking at the attached vibration problem. The solution in the manual includes the spring potential energy but does NOT include the gravitational potential energy of the hanging mass. Can someone explain why gravitational potential energy is not included when deriving the equation of motion? I tried asking ChatGPT but kept going in circles and couldn't figure out. Thanks!

Similar threads

  • · Replies 4 ·
Replies
4
Views
3K
  • · Replies 12 ·
Replies
12
Views
3K
  • · Replies 3 ·
Replies
3
Views
3K
Replies
8
Views
5K
  • · Replies 19 ·
Replies
19
Views
7K
  • · Replies 25 ·
Replies
25
Views
5K
  • · Replies 5 ·
Replies
5
Views
3K
  • · Replies 5 ·
Replies
5
Views
3K
  • · Replies 15 ·
Replies
15
Views
5K