Crates.io | cyrconv |
lib.rs | cyrconv |
version | 0.4.1 |
source | src |
created_at | 2019-07-18 18:58:27.057093 |
updated_at | 2019-07-20 15:11:31.484528 |
description | A funny faux cyrillic character mapper |
homepage | https://github.com/aspera-non-spernit/cyrconv |
repository | https://github.com/aspera-non-spernit/cyrconv |
max_upload_size | |
id | 149925 |
size | 22,284 |
CYRCONV is a funny faux cyrillic character mapper. By default it transliterates characters of a given input text to cyrillic (Lоок-Дlікё) counterparts, while remaining the readability of the text. Using .flex files CYRCON.FLEX can map any character set into a desired output set.
Note: Only tested on ArchLinux. May not work on Windows. You may need to install terminal fonts for your system.
There are two options available:
Note: If you want to use the provided flex files, you have to manually download them from this repository and copy them
into a folder like /usr/local/etc/cyrconv/flex
.
$ cargo install cyrconv
Build the program in the src/bin folder and move it to the destination folder.
Note: Make sure you save the flex
files from the flex folder outside the project folder.
There is currently no installation routine and cyrconv does not look into /usr/local/etc/.. for flex files by default.
Example:
// compile a release version
$ cargo build --release cyrconv
$ strip target/release/cyrconv
// copy into the user program folder
$ sudo cp target/release/cycronv /usr/local/bin
// make it executable
$ sudo chmod 755 /usr/local/bin/cyrconv
// copy flex files
$ sudo mkdir /usr/local/etc/cyrconv
$ sudo cp flex /usr/local/etc/cyrconv/
The program allows you to pipe a string to pass it as a single argument or as multiple arguments. If you want to use the flex option you have to pass them them as the first argument.
There are several ways Cyrconv can be used.
Note: From version 0.4.0 all input strings must be enclosed in "
Cyrconv now supports the help
argument
$ cyrconv help
$ cyrconv -h
$ cyrconv --help
You can pass the input text alone or with an optional flex file. Examples:
$ cyrconv "Hello Friends"
$ cyrconv "How are you?" flex {..}/nko.flex
Piping (|) a source or reading from a file.
$ echo "Hello Friend!" | cyrconv
$ echo "Hello Friends!" | cyrconv flex {..}/1337-lite.flex
The < operator is the first argument. The optional .flex file works as well.
Examples:
$ cyrconv < ../Documents/the_hunger_games.txt
$ cyrconv < ../Documents/the_hunger_games.txt flex {..}/braille.flex
Reading a text file or command output also works through piping.
Example:
$ ls -la | cyrconv
$ printf "Hello World\nHow are you?" | cyrconv
$ less LICENSE.md | cyrconv flex {..}/1337-lite.flex
You can write a multiline text into the console. The command string :quit
executes the mapping and quits the program.
Examples:
$ cyrconv
When the seagulls follow the trawler, it is because they think sardines will be thrown into the sea.
Interesting...
:quit
Шнёп тнё ѕёаgцllѕ fоllош тнё тгашlёг, іт іѕ вёсацѕё тнёч тніпк ѕагdіпёѕ шіll вё тнгошп іпто тнё ѕёа.
Іптёгёѕтіпg...
$ cyrconv flex {..}/braille.flex
Hello World.
How are you today?
:quit
⠓⠑⠇⠇⠕⠀⠺⠕⠗⠇⠙.
⠓⠕⠺⠀⠁⠗⠑⠀⠽⠕⠥⠀⠞⠕⠙⠁⠽?
If you want to map a string that contains ' or " you have to escape the character or surround the string with the other one, that's not in the string.
Examples:
$ echo "What's up" | cyrconv
$ cyrconv "That's pretty \"cheap\"." flex {..}/braille.flex
$ echo "If you want to map a string that contains \' or \" you have to escape the character \
or surround the string other one, that\'s not in the string." | cyrconv
**Note:**Escaping characters is not required via stdin.
The Simple Mapper takes a set of characters and maps it to a target character set of same length.
Cyrconv.flex profives default mapping set. The Simple Mapper can also be used with an optional .flex file, as previous exmaples have shown.
A number of simple mapping sets are provided in the flex
folder. You can create your own.
The default mapping works without a .flex file.
cyrconv sentence
Example:
$ cyrconv When the seagulls follow the trawler, it is because they think sardines will be thrown into the sea.
Шнеп тне ѕеаgцllѕ fоllош тне тгашlег, іт іѕ весацѕе тнеч тніпк ѕагdіпеѕ шіll ве тнгошп іпто тне ѕеа.
The flex option allows you to load a custom character mapping file.
cyrconv flex {flex_file} sentence
Example:
$ cyrconv "When the seagulls follow the trawler, it is because they think sardines will be thrown into the
sea" flex rot-13.flex
Jura gur frnthyyf sbyybj gur genjyre, vg vf orpnhfr gurl guvax fneqvarf jvyy or guebja vagb gur frn
The flex file is a simple text file that consists of two lines.
The first line is a string of characters that matches expected input characters.
The second line is a string that consists of characters of the desired output character set.
Both lines must have the same character count.
Btw, the character calle СІЯСЦМҒLЁХ ' ˇ ' maps into the character called СДЯОП ' ^ '.
You can also combine different character sets. Keep in mind, that for each output there must be a flex file that provides the output as input.
Examples:
$ cyrconv "Hello my friend. Nastrowje." flex {..}/1337-lite.flex | cyrconv
Н3ll0 мч fг13п). П4ѕтг0шј3.
If you cannot see all characters in this section, you might have to install additional terminal fonts. See the Wiki for your linux distro for further information.
Wh3n th3 s34gulls f0ll0w th3 tr4wl3r, 1t 1s b3(4us3 th3y th1nk s4r)1n3s w1ll b3 thr0wn 1nt0 th3 s34.
Note: This is the correct transliteration from Latin to Braille.
⠺⠓⠑⠝⠀⠞⠓⠑⠀⠎⠑⠁⠛⠥⠇⠇⠎⠀⠋⠕⠇⠇⠕⠺⠀⠞⠓⠑⠀⠞⠗⠁⠺⠇⠑⠗,⠀⠊⠞⠀⠊⠎⠀⠃⠑⠉⠁⠥⠎⠑⠀⠞⠓⠑⠽⠀⠞⠓⠊⠝⠅⠀⠎⠁⠗⠙⠊⠝⠑⠎⠀⠺⠊⠇⠇⠀⠃⠑⠀⠞⠓⠗⠕⠺⠝⠀⠊⠝⠞⠕⠀⠞⠓⠑⠀⠎⠑⠁.
Шнёп тнё ѕёаgцllѕ fоllош тнё тгашlёг, іт іѕ вёсацѕё тнёч тніпк ѕагdіпёѕ шіll вё тнгошп іпто тнё ѕёа.
WႬeი ჯႬe Ⴝeaჳullჷ follow ჯႬe ჯrawler, iჯ iჷ ხeეauჷe ჯႬeႸ ჯႬiიk ჷarძiიeჷ will ხe ჯႬrowი iიჯo ჯႬe ჷea.
Ψhεη ͳhε ϟεαgυιιϟ ϝοιιοω ͳhε ͳͱαωιεͱ, iͳ iϟ βεϛαυϟε ͳhεγ ͳhiηκ ϟαͱδiηεϟ ωiιι βε ͳhͱοωη iηͳο ͳhε ϟεα.
Wߚen ߙߚe Seߡgߎlls fߋllߋW ߙߚe ߠrߡWler? ߊߙ ߊs ߕeߏߡߎse ߙߚeߌ ߙߚߊnk Sߡr߄ߊnes Wߊll ߕe ߙߚrߋWn ߊnߙߋ ߙߚe seߡ,
Jura gur frnthyyf sbyybj gur genjyre, vg vf orpnhfr gurl guvax fneqvarf jvyy or guebja vagb gur frn.
Wⴼⴺⵍ ⵜⴼⴺ SⴺⴷGⵡⵃⵃS FⵙⵃⵃⵙW ⵜⴼⴺ ⵜRⴷWⵃⴺR, ⵊⵜ ⵊS BⴺⵎⴷⵡSⴺ ⵜⴼⴺⵖ ⵜⴼⵊⵍK SⴷRDⵊⵍⴺS Wⵊⵃⵃ Bⴺ ⵜⴼRⵙWⵍ ⵊⵍⵜⵙ ⵜⴼⴺ Sⴺⴷ.
Zzzz zzz zzzzzzzz zzzzzz zzz zzzzzzz, zz zz zzzzzzz zzzz zzzzz zzzzzzzz zzzz zz zzzzzz zzzz zzz zzz.