News for hackers. Stuff that matters.
Re:Shakespeare.txt.jpg: A JPEG compression experiment by ZeroGravitas on Monday June 17, 2013 @10:46AM (#5893458)
That's an interesting idea, and it's cool that he took it as far as he did, but I'm surprised by the last paragraph:

We're sensitive to data loss in text form: we can only consume a few dozens of bytes per second, and so any error is obvious. Conversely, we're almost blind to it in pictures and images: and so losing quality doesn't bother us all that much.

I'm not aware of any "lossy" encodings for text, but I assume they'd do pretty well on shakespeare and pretty terrible on images encoded as text. It's just that the techniques are tuned for the standard data, so most things you smuggle through are going to be "weird" and suffer more than usual.

Re:Shakespeare.txt.jpg: A JPEG compression experiment by growse on Monday June 17, 2013 @04:10PM (#5895605)
Lossy encodings for text are easy. I can compress the entirety of 'Romeo And Juliet' to this:

"Boy and girl fall in love, they both die."

Yes, it's lost a bit of detail and resolution, but it's significantly more compact than the original, while retaining somewhat the same recognizable message. All we need next is a computer algorithm that generates TLDR.

Re:Shakespeare.txt.jpg: A JPEG compression experiment by czr80 on Monday June 17, 2013 @05:38PM (#5896133)
I hear Yahoo might have one.
Re:Shakespeare.txt.jpg: A JPEG compression experiment by kevingadd on Monday June 17, 2013 @01:03PM (#5894337)
You could probably quite effectively do 'lossy' compression on text given enough knowledge of the language. Compress words with similar meanings into each other, automatically select variants of words based on context (plurality, etc), automatically insert punctuation, and so on.

The result would probably look like it was written by someone with an incomplete knowledge of English (or by a machine) but might end up being quite readable.

Of course, on the other hand, you can just compress the text with LZMA :)

Re:Shakespeare.txt.jpg: A JPEG compression experiment by abruzzi on Monday June 17, 2013 @02:35PM (#5895010)
The easiest/quickest lossy text compressions that could theoretically almost halve the size of your data is to drop capitalization (and also assuming you're using some minimal encoding that can only encode the characters you're using.) there is some semantic info that is imparted by capitals, but not much.
Re:Shakespeare.txt.jpg: A JPEG compression experiment by mistercow on Monday June 17, 2013 @03:38PM (#5895398)
No, that would not cut the length in half, or anything close to it.

One form of "minimal encoding" you're describing would be to use arithmetic coding where the predictor simply assigns equal probability to each symbol actually used in the input. For example, if you encode a 1000 letter message which includes at least one instance of every letter (both upper and lower case), then you'd have 52 symbols, and your simple prediction step would simply assign 1/52 as the probability for each symbol. This will result in a constant 5.7 bits of output per symbol. So your 1000 letter message would encode at 5700 bits.

Now, suppose you discard capitalization. Now there are 26 symbols, each assigned a probability of 1/26, resulting in a constant 4.7 bits per symbol. Your 1000 letter message will now encode at 4700 bits. So you only save about 17% in this very generously constructed case.

The mistake you've made is to assume that cutting the number of symbols in half will cut the symbol length in half. In fact, reducing the number of symbols by half merely reduces the symbol length by a single bit. For example, you need 8 bits to specify between 256 possibilities, but if you cut the possibilities down to 128, you still need 7 bits.

In addition, lossy compression is usually combined with lossless compression, and a smart predictor could use context to reduce the cost of capital letters to much less than one bit per symbol (assuming that the text has a predictable structure, like human language).

Re:Shakespeare.txt.jpg: A JPEG compression experiment by drewcrawford on Monday June 17, 2013 @01:33PM (#5894550)
it's comomn kdownlege in inoitrmfaon thoery ciecrls taht you can reoerdr lttres in wrods and the relsut is pecfretly undeastnrdlabe as lnog as you keep the fsirt and lsat letrtes the smae.

http://ieeexplore.ieee.org/xpl/freeabs_all.jsp?arnumber=4126...

Re:Shakespeare.txt.jpg: A JPEG compression experiment by tbrownaw on Monday June 17, 2013 @02:59PM (#5895176)
http://www.mrc-cbu.cam.ac.uk/people/matt.davis/cmabridge/

I've written this page, to try to explain the science behind this meme. There are elements of truth in this, but also some things which scientists studying the psychology of language (psycholinguists) know to be incorrect.

The page also contains a number of counter-examples, show that the result often is not "pflteecry uaaedlbdrsntne".

Re:Shakespeare.txt.jpg: A JPEG compression experiment by VMG on Monday June 17, 2013 @01:36PM (#5894575)
That is more about built-in redundancy and error correction than lossy compression.
Re:Shakespeare.txt.jpg: A JPEG compression experiment by zokier on Monday June 17, 2013 @02:04PM (#5894780)
But such features could be exploited to make lossy compression. If humans can recognize words with some of the letters randomized, then there is no need to store those letters individually. Instead just insert random letters at decomperssion phase.
Re:Shakespeare.txt.jpg: A JPEG compression experiment by reeses on Tuesday June 18, 2013 @04:12PM (#5901738)
This is in fact not proven for the entire population.
Re:Shakespeare.txt.jpg: A JPEG compression experiment by repiret on Monday June 17, 2013 @01:27PM (#5894508)
In a certain sense, thats what Reader's Digest Condensed Books are all about - lossy text compression.

But we let machines do it all the time too. Go from UTF-8 to ASCII-7. You won't loose much in English - orientation of quotation marks, distinction among various types of dashes. Naïve and Café and El Niño and other words borrowed from other languages and commonly spelt with their native character set would also need to be spelt differently.

You could drop down to 5 bits per character, giving you only upper case letters and room for 6 punctuations. Numerals would need to be spelt out, which means you could no longer distinguish among these: 1, One, ONE, one.

You can also find lots of lossy text compression, focused on minimizing characters, on Twitter or in text messages.

Re:Shakespeare.txt.jpg: A JPEG compression experiment by csense on Tuesday June 18, 2013 @01:40AM (#5897745)
> orientation of quotation marks

I hate it when I open a document and there's non-ASCII characters cluttering it up just because someone wanted magic quote marks. If you must have oriented quotes, you should do them the ``LaTeX way,'' so you don't have to get into Unicode, which sucks [1].

[1] https://news.ycombinator.com/item?id=4835507

Re:Shakespeare.txt.jpg: A JPEG compression experiment by VMG on Monday June 17, 2013 @01:38PM (#5894582)
In some sense TL;DR is a form of lossy compression. You don't express your complete thoughts but a shortened version of it.

IMHO.

Re:Shakespeare.txt.jpg: A JPEG compression experiment by tg3 on Monday June 17, 2013 @01:13PM (#5894421)
Exactly - the whole point of lossy compression is to compress it in a way that has a minimal effect on the type of data you're trying to compress while maximizing the compression.

Using a compression method on a different data set is unsurprisingly ineffective.

We're not "blind" to the changes in images, but the algorithm is designed that the changes are minimal when in image form.

Re:Shakespeare.txt.jpg: A JPEG compression experiment by CJefferson on Monday June 17, 2013 @01:59PM (#5894738)
Yes, I'm sure I could come up with a lossy encryption system for text. There was a popular meme going around for a while of sorting all but the first and last characters of a word.
Re:Shakespeare.txt.jpg: A JPEG compression experiment by TheCraiggers on Monday June 17, 2013 @03:02PM (#5895192)
Interesting idea. So basically any word with greater than 3 characters could be converted into beginning / end char and a number representing the number of chars in between.

I wonder how much of our ability to read text like that is based on context though. Also, I'm going to assume that this only works with fairly common words (which is unique for each person). For example, I'm guessing running said compression on the works of Shakespeare wouldn't work as well, since most people struggle to make sense of them to begin with.

Re:Shakespeare.txt.jpg: A JPEG compression experiment by hobs on Monday June 17, 2013 @10:32PM (#5897186)
i18n
Re:Shakespeare.txt.jpg: A JPEG compression experiment by minikites on Monday June 17, 2013 @01:04PM (#5894344)
Post the text to Tumblr and JPGs to Flickr and then sit back and reflect on lossy text compression for website titles.