I have to divide my life into things that I can change and those I can't, and I wasn't prepared for how quickly I would need to look for google alternatives when they alleged I was a computer and locked me out of my account. I had to realize how dished out to them I truly am. I did not choose for this to be the year I would have to talk about Google, and would be embarrassed for others to know how much this feels like a divorce or jilted lover saga. Google and I: we had some good times, but we've grown apart. Having to switch from my familiar android just takes my breathe away, but I'll come out the other side. So, I'll go with apple until they have some outrageous untenability, and so it goes with the corporate goliaths: pick your poison and exposure.

I rely on google heavily in translation scripts and tried to work up a reasonably-sized SSCCE for it. This script worked better before it worked worse, but it should suffice as a starting point:

#!/usr/bin/perl use v5.030; # strictness implied use warnings; use Path::Tiny; my $file_in = path("/home/fritz/Desktop/1.enchanto.txt"); my $file_out = path('/home/fritz/Desktop/1.enc_trans.txt'); my $lang = 'es'; my $command = 'trans -b :$lang "$para">$buffer'; my $guts = $file_in->slurp_utf8; my @spl = split('\n', $guts); say @spl; my $buffer; for my $para (@spl){ say $para; my $trans = system("$command"); say $buffer; #$file_out->spew_utf8( $para, $trans ); } __END__

What I typically do is use perl to wrap the trans call from the soimort translate shell on github. I'm not wild about this dependency anymore, and the resulting calling code is hideous, but it has been reliable in at least this form:

foreach (@matching2) { my $eng_path = path( $vars{eng_captions}, $_ ); say $fh "##$_##"; my $rus_path = path( $vars{rus_captions}, $_ )->touchpath; say "rus_path is $rus_path"; my $content = path($eng_path)->slurp_utf8; $content =~ s/^\s+|\s+$//g; say $fh "$content"; system("trans :$lang file://$eng_path >$rus_path"); }

I'd like to get away both from this trans package and google, so I'm wondering what else is out there. I think this answer has changed over the last year or so with the balkanization of the internet. For example, in the following snippet, I think the bing one succeeds and the yandex has failed (from my perspective), and this, as I say, over the course of the last year:

print "Get other translations(y/n)?: "; my $prompt = <STDIN>; chomp $prompt; if ( $prompt eq ( "y" or "Y" ) ) { my @translators = qw /yandex bing/; for my $remote (@translators) { my $trans_munge = path( $vars{translations}, "$remote." . $munge + ); ## use trans shell say "getting translation from $remote"; system("trans :$lang -e $remote file://$in_path >$trans_munge"); }

So let me ask the question like this, given that I want to get away from the trans package and google, what options do I have for machine translations with perl?

Thanks for your comment,


In reply to De-googleizing translation scripts by Aldebaran

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.