Giter Site home page Giter Site logo

morse's Introduction

morse

Decode ambiguous Morse codes using dictionaries.

Why?

I've been an owner of a beautiful travel mug made by a Russian manufacturer Biostal for a couple of years already. But just recently, I found out that the logo on this mug has a set of dashes and dots, which looks like a Morse code -.-..-.---......----.---.:

mug's logo

I wanted to check if this code-like looking dashed line is actually a meaningful message encoded using Morse code or just a random sequence of graphical primitives. As you may know, the crucial part of Morse code is pauses being made between letters and words, but apparently, a sequence on the logo was missing this information, which makes decoding indeterminate. For instance, without the knowledge of where letter- and word-breaks should go, code -. may equally be decoded as et or a.

How does it work?

I anticipated that taking brute-force approach of just finding all possible input string permutations resulting in a given code would produce too many nonsense options, so that I'll be flooded with them and won't find an original message (if there was any). I actually wrote a small function calculating the amount of all possible input messages for a given code. It gave me the number of 6994659 for the code from my mug. No way I would try to go through them manually!

So I decided to somehow limit possible input messages to only those, which may have a chance of making sense. The obvious solution was to compose them from actual natural language words, which, in turn, would be collected from some dictionaries. But even this approach was giving me tons of stuff like tln md i ut matte. Finally, I realized that for the length of the code I was dealing with, the message with the least amount of word would be the most meaningful. That's why current implementation sorts all found input messages by the number of words in ascending order and returns first 50 items.

Did I manage to decode my travel mug?

Yes. Turned out code says crosstown, which is a name of a product line my mug belongs to. I also tried to decode it using Russian words and Russian Morse code, but the most meaningful message I got was куем несем тын, which, well is not tremendously likely was the original source.

Where did I get dictionaries from?

morse's People

Contributors

pa3 avatar

Stargazers

 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.