Remix.run Logo
jll29 4 hours ago

Yes: you can classify a test file by topic with gzip as follows:

  gzip -9 sports.txt   testfile.txt

  gzip -9 politics.txt testfile.txt

  gzip -9 business.txt testfile.txt
(ass. sports.txt politics.txt and business.txt are text docs pertaining from the sports, politics and business domains, respectively, and have equal size)

The test file belongs to the topic with the smallest size *.gz file.

Witten's group at Waikato uni were perhaps the first to work on this.

Also check out the Hutter prize if you are interested in this.

stingraycharles 2 hours ago | parent | next [-]

Back in the day - maybe two decades ago - I implemented language detection like this.

I seeded gzip compressors’ dictionaries with Wikipedia articles in different languages.

I would then try to use said dictionaries on any random text, and the one that was best able to compress it, was the correct language.

Absolutely totally not the best approach, but very fast and super simple to implement.

LPisGood 2 hours ago | parent | prev | next [-]

There are some deep connections between machine learning, compression, and cryptography with information theory as a common thread.

Also, I’ve never seen “ass.” Used to shorten “aside” — I typically use N.B. but perhaps only for important ones.

shoo 2 hours ago | parent | next [-]

For anyone wanting an introductory text for information theory & that explores some of these connections & applications, it's worth checking out the late David MacKay's 2003 textbook Information Theory, Inference & Learning Algorithms https://www.inference.org.uk/itila/

matzf 2 hours ago | parent | prev | next [-]

The "ass." more likely stands for "assuming".

chrisweekly 24 minutes ago | parent [-]

Yeah, I read it as "assuming" too.

arrowsmith 2 hours ago | parent | prev [-]

3Blue1Brown has a good video about this: https://www.youtube.com/watch?v=l6DKRf-fAAM

woadwarrior01 2 hours ago | parent | prev | next [-]

aka Normalized compression distance (NCD). Its close cousin: Normalized Google distance (NGD) is also super interesting!

https://en.wikipedia.org/wiki/Normalized_compression_distanc...

m-hodges an hour ago | parent | prev [-]

[dead]