-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCalculateIndependentFeatures.pl
More file actions
82 lines (69 loc) · 2.85 KB
/
CalculateIndependentFeatures.pl
File metadata and controls
82 lines (69 loc) · 2.85 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
#!/usr/bin/perl
# Written by M. Paramita (m.paramita@sheffield.ac.uk)
# Last update 16 August 2011
use strict;
use warnings;
use utf8;
use File::Find;
use lib './Subs/';
use AllInterLinksOverlapSub;
use AllOutLinksOverlapSub;
use DocLengthWithoutTranslationSub;
use ImageLinksFilenameOverlapSub;
use ImageLinksOverlapSub;
use ImageLinksWordsOverlapSub;
use URLLevelAndCharacterOverlapSub;
my $temp = "@ARGV";
my ($source, $target, $outputPath, $metadataFile);
if (($temp =~ m/--outputFolder/) && ($temp =~ m/--source/) && ($temp =~ m/--target/) && ($temp =~ m/--metadata/)) {
}
else
{
print "-------------------------------------------------------------------------------------------------------\n";
print "To run this script, please add the source language and target language after the name of the script:\n\n";
print " \"perl CalculateIndependentFeatures.pl --source [sourceLang] --target [targetLang] --metadata\n";
print " [metadataFile] --outputFolder [outputFolder]\"\n\n";
print "An example of its use is:\n\n";
print " \"perl CalculateIndependentFeatures.pl --source HR --target EN --metadata C:\\ACCURAT\\HR-EN-pairs.txt\n";
print " --outputFolder C:\\ACCURAT\\Output\"\n";
print "-------------------------------------------------------------------------------------------------------\n";
exit;
}
for (my $i=0; $i < scalar @ARGV; $i = $i+2) {
if ($ARGV[$i] eq "--source") {
$source = $ARGV[$i+1];
}
elsif ($ARGV[$i] eq "--target") {
$target = $ARGV[$i+1];
}
elsif ($ARGV[$i] eq "--outputFolder") {
$outputPath = $ARGV[$i+1];
if ($outputPath =~ m/\/$/) {
}
else {
$outputPath .= "/";
}
}
elsif ($ARGV[$i] eq "--metadata") {
$metadataFile = $ARGV[$i+1];
}
else {
print "Format $ARGV[$i] is not recognized. Please correct the format and restart the tool.\n";
exit();
}
}
print "- Calculating All Inter Links Overlap ...\n";
AllInterLinksOverlapSub "$source\t$target\t$metadataFile\t$outputPath";
print "- Calculating All Out Links Overlap ...\n";
AllOutLinksOverlapSub "$source\t$target\t$metadataFile\t$outputPath";
print "- Calculating Doc Length without Translation ...\n";
DocLengthWithoutTranslationSub "$source\t$target\t$metadataFile\t$outputPath";
print "- Calculating Image Links Filename Overlap Sub ...\n";
ImageLinksFilenameOverlapSub "$source\t$target\t$metadataFile\t$outputPath";
print "- Calculating Image Links Overlap ...\n";
ImageLinksOverlapSub "$source\t$target\t$metadataFile\t$outputPath";
print "- Calculating Image Links Words Overlap ...\n";
ImageLinksWordsOverlapSub "$source\t$target\t$metadataFile\t$outputPath";
print "- Calculating URL Level And Character Overlap ...\n";
URLLevelAndCharacterOverlapSub "$source\t$target\t$metadataFile\t$outputPath";
print "\nIndependent features were successfully extracted!\n";