Wednesday, September 29, 2010

PerlEdit

I just started with programing, and I am using PerlEdit to write Perl scripts with ease. It colors different aspects (e.g. comments green, commands blue, strings purple), and has a nifty little triangle button that allows you to do the program automatically.

It's still on trial, but I looked and it only mentioned the "Debug feature" as going away when the trial is done, and I've yet to use it.

Download it here, and look at this sample script which I gave up on:

#!usr/local/bin/perl
# Copyright (C) 2010
srand();
# ---CHOOSING PLACES OF ARTICULATION---
# VARIABLES FOR PLACES
@placs = ('labial','alveolar','velar');
@nplacs = ('retroflex','palatal','uvular','glottal');
# SELECTING THE PLACES
$max = int(rand(3));                  # times looped is an integer between 0-3
for ($i = 0; $i <= $max; $i++) {      # starts the loop
$ntodelete = int(rand(7-@placs));     # the number in nplacs that will be moved to placs
$placs[@placs] = $nplacs[$ntodelete]; # added to @placs
delete $nplacs[$ntodelete];           # deleted from @nplacs
};
# ALVEOLAR > DENTAL SOMETIMES
$dent = int(rand(2)); # whether yes or no
if ($dent == 1) {     # if yes
$placs[1] = 'dental'  # switch to dental
};
# ---CHOOSING VOICING---
$blos = int(rand(2));          # whether to have blosives
if ($blos == 1) {              # if so
$dinplos[@dinplos] = 'voicing' # add voicing
}
# ---CHOOSING ASPIRATION---
$phlos = int(rand(2));            # whether to have phlosives
if ($phlos == 1) {                # if so
$dinplos[@dinplos] = 'aspiration' # add aspiration
};
# ---UNVOICED ASPIRATION---
if ($dinplos[1] == 'aspiration') {          # if bhlosives are possible,
$nobhlos = int (rand(2));                   # decide yes or no
if ($nobhlos == 1) {                        # if no,
$dinplos[1] = 'aspiration_in_the_voiceless' # say so
};
};
# ---SAY NONE FOR PLOSIVES---
if (@dinplos == 0) { # if no distinctions in plosives,
$dinplos[0] = 'none' # say so
};
# ---FRICATIVES---
# ONLY S?
if ($placs[1] == 'alveolar') { # if there is /t/,
$sonly = int(rand(2));         # decide if only /s/,
}                              # to be stated later
# ---ADD POSTALVEOLAR ONLY IF $sonly isn't 1
if ($sonly != 1) {              # if there isn't only /s/
$pamove = int(rand(2));         # decide if possibly postalveolar
if ($pamove == 1) {             # if so,
$placs[@placs] = $postalveolar; # say so
};
};
# ---VOICING IN FRICATIVES---
$vricative = int(rand(2)); # decide if voicing, to be set later
# RHOTICS
@rposs = ('trill','tap','approximant','retroflex approximant','uvular trill');
$rhotic = @rposs[int(rand(4))];
# LATERALS
@lposs = ('approximant', 'fricative', 'approxiant and fricative');
$latrl = @rposs[int(rand(2))];
# To be done:
# get the order for places of articulation right
# fix unvoiced aspiration
# ---PRINTING---
print "----PHONOLOGY----\n----Consonants---\nPlaces of Articulation:@placs\n"; # show places
print "Distinctions in Plosives:@dinplos\n";                                   # show distinctions in plosives
if ($sonly == 1) {                                                             # if only s,
print "Fricatives are only in the alveolar.\n"                                 # say so
};
if ($vricative == 1) {                                                         # if voiced fricatives
print "Distinctions in Fricatives:voicing\n"                                   # say so
};
print "Rhotic:$rhotic\nLateral:$latrl\n";                                      # show rhotic/lateral

No comments:

Post a Comment