vriendelik aardig
polisieman agent
net-net amper
gedierte beest
naak bloot
homoseksueel flikker
bronstig geil
menskop hoofd
toedraai inpakken
dierekop kop
onskuldig onnozel
perdeteler paardenfokker
dennebol pijnappel
####
#!/usr/bin/perl-w
use strict;
use warnings;
use open ':utf8';
use autodie;
open NONMATCHINPUT, "OutputIdenticalCognates.txt";
open ONIC, ">OutputNonIdenticalCognates.txt";
open ONC, ">OutputNonCognates.txt";
my %nonmatchhash;
while (my $line = )
{
chomp $line;
#split the line on tab
my ($nonmatchhashkeys, $nonmatchhashvalues) = split /\t/, $line;
$nonmatchhash{$nonmatchhashkeys} = $nonmatchhashvalues;
#if the values of the hash are exactly the same as the keys of the hash
if ($nonmatchhash{$nonmatchhashkeys} = $nonmatchhash{$nonmatchhashvalues})
{
#print both key and value to OutputIdenticalCognates.txt, separated by a tab
print OIC "$nonmatchhashkeys\t$nonmatchhashvalues\n";
}
#assign each key in the hash to $AfrColumn1token
foreach my $AfrColumn1token(keys %nonmatchhash)
{
#if the Afrikaans word ($AfrColumn1token) contains: anything, followed by 'agtig', followed by 'e' or 'er' or 'ste' (optional), at the end of the string
if ($AfrColumn1token =~ /(.*)(agtig)(e|er|ste)?$/)
{
#then, by using a foreach, assign each value in the hash to $DutColumn2token
foreach my $DutColumn2token (values %nonmatchhash)
{
#And then, if the Dutch word ($DutColumn2token) contains: anything, followed by 'achtig', followed by 'e' or 'er' or 'ste' (optional), at the end of the string
if ($DutColumn2token =~ /(.*)(achtig)(e|er|ste)?$/)
{
#print it to OutputNonIdenticalCognates.txt
print ONIC "$AfrColumn1token\t$DutColumn2token\n";
}
}
}
else
{
#else, print it to OutputNonCognates.txt
print ONC "$AfrColumn1token\t$DutColumn2token\n";
}
}
}
####
if $AfrColumn1token consists of:
anything, followed by 'agtig', followed by 'e' or 'er' or 'ste' (optional), at the end of the string,
#then
check to see if DutColumn2token consists of: anything, followed by 'achtig', followed by 'e' or 'er' or 'ste' (optional), at the end of the string.
#then
that particular key and value must be written to OutputNonIdenticalCognates.txt,
else write the pair to OutputNonCognates.txt.