Giter VIP home page Giter VIP logo

kubilay-karatopcu / morsecodedecoder Goto Github PK

View Code? Open in Web Editor NEW
1.0 1.0 0.0 1.72 MB

This is a Morse code translator which can be used for several utilities about Morse code such as translation between Latin and Morse, translation from Latin to its Morse code sound, and translation from Morse code where words are seperate but letters are indistincive.

Python 100.00%
morse translator sentence sound code encoding decoding python python3 morse-code

morsecodedecoder's Introduction

MorseCodeDecoder

This is a Morse code translator which can be used for several utilities about Morse code such as translation between Latin and Morse, translation from Latin to its Morse code sound, and translation from Morse code where words are seperate but letters are indistincive in which script finds all meaningful words among all possible combinations where the definition of "meaningful" is provided by a list of words in English. Words list is taken from dwyl/english-words as you may find in the following link https://github.com/dwyl/english-words

How to use?

translateSentence()

This is the master method which makes the translation between Latin and Morse.

Parameters

sentence : str
    The sentence that is needed to be translated.
type : str -> ['LatinToMorse','MorseToLatin']
    Translation type.
    If the translation "type" is "LatinToMorse" then the sentence must be given in the form of space seperated words.
    If the translation "type" is "MorseToLatin" then the sentence must be given in the form where letters are seperated 
    with spaces and the words are seperated with "/".
words : str -> ['Distinctive','Indistinctive']
    It shows whether letters are seperated and known or the words are seperated but  the letters are not known.
    It is needed to be defined if translation type is MorseToLatin. If "words" is "Distinctive" then the sentence 
    must be given in the form where letters are seperated with spaces and the words are seperated with "/".       
    If "words" is "Indistinctive" then the sentence must be given in the form where words are seperated with "/" but 
    letters must be joint.

Returns

type = LatinToMorse
    str
        Translation in Morse. The sentence is in the form where letters are seperated with spaces and the words 
        are seperated with "/"
type = MorseToLatin & words = Distinctive
    str
        Translation in Latin. Regular English sentence.
type = MorseToLatin & words = Indistinctive
    dictionary
        A dictionary where keys are the words in Morse, and values are all possible meaningful translations in Latin.

createMorseCodeSound()

This method creates a .wav file of Morse from a Latin word.

Parameters

sentence : str
    Regular English sentence which is seperated with spaces.
filepath : str
    File path where the .wav will be saved.

Examples

Translation From Latin to Morse

sentence = "Hello world!" translationInMorse = MorseCodeDecoder().translateSentence(sentence, type = "LatinToMorse")

It returns ".... . .-.. .-.. ---/.-- --- .-. .-.. -.. -.-.--"

Translation From Morse to Latin

sentence = ".... . .-.. .-.. ---/.-- --- .-. .-.. -.. -.-.--" translationInLatin = MorseCodeDecoder().translateSentence(sentence, type = "MorseToLatin")

It returns "HELLO WORLD!"

Translation From Morse where letters are not seperate.

sentence = "../-...-...---/-.-----..-/....-..-.-.--/-...--.....-/--......../-.-----..-.-./...---..-.-.." morseDecoder.translateSentence(sentence, type = "MorseToLatin", words = "Indistinctive")

It returns a dictionary showing all meaningfull possibilities for each word.

Making the sound of Morse from Latin

sentence = "Hello world" MorseCodeDecoder().createMorseCodeSound(sentence, filepath = "Sounds//Helloworld")

Saves "Helloworld.wav" file into the given path

morsecodedecoder's People

Contributors

kubilay-karatopcu 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.