BARBELITH underground
 

Subcultural engagement for the 21st Century...
Barbelith is a new kind of community (find out more)...
You can login or register.


Making your own translation program?

 
 
All Acting Regiment
07:16 / 08.11.05
I'm looking for a program that will translate text according ot a set of rules I lay down: e.g. Cat = Jerha, and you would type Cat in and it would come out as Jerha. Any ideas?
 
 
iconoplast
13:14 / 08.11.05
Write a BASIC program with a lot of If -> Then Print clauses?
 
 
Axolotl
13:34 / 08.11.05
Macros in Word using find & replace, or possibly AutoCorrect?
Hardly an elegant solution, but it should work, and would require a minimum of tech-skills (If you are some 733t h4xx0r god please ignore this).
 
 
w1rebaby
13:36 / 08.11.05
I could write you one in five minutes in Perl. You'd have to have Perl on whatever computer you want to run it on though.
 
 
w1rebaby
14:39 / 08.11.05
I dunno, summat like this

#!/usr/bin/perl -w

use strict;

# read in list

my %subs;
open(FILE, '<sublist.txt') || die;
while (<FILE> ) {
   chomp $_;
   if (/^([^\t]+)\t([^\t]+)$/) {
      $subs{$1} = $2;
      print STDERR "$1 => $2\n";
   }
}
close FILE;

# substitute words

while (<> ) {
   foreach my $key (keys %subs) {
      my $sub = $subs{$key};
      s/$key/$sub/g;
   }
   print $_;
}


and then you save a tab-delimited list of words to substitute as sublist.txt
 
 
All Acting Regiment
22:57 / 08.11.05
I'll try setting up an auto-correct feature. I'm a bit pressed for time, so I'll look into the coding options later, and thanks for 'em!
 
  
Add Your Reply