Transliterate English text using the Greek alphabet: Difference between revisions

m
syntax highlighting fixup automation
m (syntax highlighting fixup automation)
Line 100:
{{trans|Julia}}
Implementation:
<langsyntaxhighlight Jlang="j">endings=: {{
W=. (#~ tolower=toupper) (32}.127{.a.)-.":1234567890x
,(x,"1 0 W);&(7&u:)"1 y,"1 0 W
Line 114:
'D';'Δ'; 'F';'Φ'; 'G';'Γ'; 'J';'I'; 'L';'Λ'; 'P';'Π'; 'Q';'Κ';
'R';'Ρ'; 'S';'Σ'; 'Y';'U'; 'W';'Ω'; 'X';'Ξ'
}} -.LF)^:_</langsyntaxhighlight>
 
Examples:
<langsyntaxhighlight Jlang="j">txt1=:'The quick brown fox jumped over the lazy dog.'
txt2=:{{)n
I was looking at some rhododendrons in my back garden,
Line 140:
 
trans txt3
σφινξ οφ βλακ κυαρτζ, ιυδγε μυ βοω.</langsyntaxhighlight>
 
=={{header|Julia}}==
<langsyntaxhighlight lang="ruby">const texts = [
"""The quick brown fox jumped over the lazy dog.""",
"""I was looking at some rhododendrons in my back garden,
Line 170:
println("$txt\n", "="^65)
end
</langsyntaxhighlight>{{out}}
<pre>
The quick brown fox jumped over the lazy dog.
Line 197:
 
=={{header|Perl}}==
<langsyntaxhighlight lang="perl">use v5.36;
use experimental 'for_list';
use utf8;
Line 212:
'The quick brown fox jumped over the lazy dog.',
'I was looking at some rhododendrons in my back garden, dressed in my khaki shorts, when the telephone rang.',
'As I answered it, I cheerfully glimpsed that the July sun caused a fragment of black pine wax to ooze on the velvet quilt laying in my patio.';</langsyntaxhighlight>
{{out}}
<pre>The quick brown fox jumped over the lazy dog.
Line 227:
Just for a laugh, figure out the rules directly from the task description.
You can run this online [http://phix.x10.mx/p2js/greek.htm here] (and it'll probably look better in a browser than on a Windows console).
<!--<langsyntaxhighlight Phixlang="phix">(phixonline)-->
<span style="color: #008080;">with</span> <span style="color: #008080;">javascript_semantics</span>
<span style="color: #008080;">constant</span> <span style="color: #000000;">task</span> <span style="color: #0000FF;">=</span> <span style="color: #008000;">"""
Line 318:
<span style="color: #000000;">g</span> <span style="color: #0000FF;">=</span> <span style="color: #7060A8;">join</span><span style="color: #0000FF;">(</span><span style="color: #7060A8;">extract</span><span style="color: #0000FF;">(</span><span style="color: #000000;">names</span><span style="color: #0000FF;">,</span><span style="color: #7060A8;">substitute_all</span><span style="color: #0000FF;">(</span><span style="color: #000000;">thedog</span><span style="color: #0000FF;">,</span><span style="color: #000000;">sub</span><span style="color: #0000FF;">,</span><span style="color: #000000;">rep</span><span style="color: #0000FF;">)),</span><span style="color: #008000;">""</span><span style="color: #0000FF;">)</span>
<span style="color: #7060A8;">printf</span><span style="color: #0000FF;">(</span><span style="color: #000000;">1</span><span style="color: #0000FF;">,</span><span style="color: #008000;">"%s\n=&gt;\n%s\n\n"</span><span style="color: #0000FF;">,{</span><span style="color: #000000;">thedog</span><span style="color: #0000FF;">,</span><span style="color: #000000;">g</span><span style="color: #0000FF;">})</span>
<!--</langsyntaxhighlight>-->
{{out}}
<pre>
Line 347:
 
=={{header|Raku}}==
<syntaxhighlight lang="raku" perl6line>sub to-Greek (Str $string is copy) {
my %pre = :Ph<F>, :ck<k>, :ee<h>, :J<I>, :rh<r>,:oo<w>, :ph<f>, :ch<χ>,
:th<θ>, :ps<ψ>, :Ch<Χ>, :Th<Θ>, :Ps<Ψ>, :kh<χ>, 's ' => 'ς ';
Line 382:
'<' ~ .uniname.subst( /.+<?after LETTER\s>/).lc ~ '>'
}).join
given 'sphinx of black quartz, judge my vow.';</langsyntaxhighlight>
{{out}}
<pre>English:
Line 417:
=={{header|Wren}}==
{{libheader|Wren-str}}
<langsyntaxhighlight lang="ecmascript">import "./str" for Char, Greek
 
var English2Greek = Fn.new { |text|
Line 524:
s = s + c
}
System.print(s)</langsyntaxhighlight>
 
{{out}}
10,327

edits