Giter VIP home page Giter VIP logo

morsify's Introduction

Morsify

Morsify - это библиотека для конвертирования текста в Азбуку Морзе или наоборот.

Одной из ключевых особенностей gem morsify, является трансляция между азбукой Морзе и кириллицей.

Установка

Добавьте эту строку в Gemfile вашего приложения:

gem 'morsify'

Затем выполните:

$ bundle

Или установите пакет morsify из Rubygems:

gem install morsify

Использование

  • Между одним символом азбуки морзе, используется один пробел.

  • Между словами отступ равен 7 пробелам.

Текст в азбуку Морзе

require 'morsify'

text = 'hello'
Morsify.encode(text)
=> ".... . .-.. .-.. ---"

text = 'текст на русском'
Morsify.encode(text)
=> "- . -.- ... -       -. .-       .-. ..- ... ... -.- --- --"

Код Морзе в кириллицу

require 'morsify'

text = "- . -.- ... -       -. .-       .-. ..- ... ... -.- --- --"
Morsify.decode(text, :ru)
=> "ТЕКСТ НА РУССКОМ"

Код Морзе в латиницу

require 'morsify'

text = "... --- ...       ... --- ..."
Morsify.decode(text)
 => "SOS SOS"

Код Морзе в WAV File

Сохраняет файл в формате .wav в текущую папку, из которой запущен основной файл программы.

В данной папке, создается подпапка, с именем текущей даты, в формате (ДД-ММ-ГГГГ).

Внутри которой будет сохранен .wav файл, с именем текущего времени, в формате (ЧЧ-ММ-СС).

require 'morsify'

text = "... --- ...       ... --- ..."
Morsify.wave(text)
=> "Generate wave file: current_path/Day-Month-Year/Hour-Min-Sec.wav"

Терминал

$> morsify
Select the operation mode: (Use ↑/↓ arrow keys, press Enter to select)
‣ Text to Morse
  Morse to Text
  Text to WAV File
  Exit
$> morsify -h
Usage: morsify [options]
    -h, --help                       Prints this help
    -e, --encode TEXT                Text to Morse
    -d, --decode MORSE_CODE          Morse to Text
    -c, --cyrillic
    -w, --wave MORSE_CODE            Morse to WAV File
    -v, --version
$> morsify -e "hello"      
=> ".... . .-.. .-.. ---"

$> morsify -d "... --- ..."
=> "SOS"

$> morsify -d ".--. .-. .. .-- . -" -c
=> "ПРИВЕТ"

В случае глобального запуска программы, файл в формате .wav, будет сохранен в домашний каталог.

$> morsify -w '... --- ...'
=> Generate wave file: /home/user/records/06-03-2020/14-10-09.wav

Тесты

bundle exec rake spec

Ресурсы

License

Code released under MIT license.

morsify's People

Contributors

dionixs avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

morsify's Issues

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.