File size: 3,197 Bytes
9f1c059
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
#word_pronunciation
use File::Copy;
use File::Slurp;
if (scalar(@ARGV)!=6)
{
	print "arg1 --> phoneset_all\n";
	print "arg2 --> phoneset_uyir\n";
	print "arg3 --> phoneset_mei\n";
	print "arg4 --> phoneset_uyirmei\n";
	print "arg5 --> word_file\n";
	print "arg6 --> any\n";
	exit(0);
}
`rm syllables`;
@word_cont = read_file($ARGV[4]);
open(handle_w,">","word");
print handle_w @word_cont[$#word_cont];	#see lts rules. For ' in english i changed it
close(handle_w);
`echo SIL > syllables`;
`perl scripts/language_check.pl $ARGV[4] temp3`;
if(read_file("lang") eq "tam")
{
	`perl scripts/vuv.pl temp3`;
	`./scripts/correct_text lists/out_word lists/o_au_map lists/phone_list`
}
else
{
	copy("temp3","lists/out_word");
}
`perl scripts/ortho_to_phonetic1.pl lists/out_word $ARGV[0] phone`;
`perl scripts/syllable_from_char.pl phone $ARGV[1] $ARGV[2] $ARGV[3] >> syllables`;
#print cat("word");
$count = scalar(split("\n",cat("syllables")));
$start = 1;
open(handle1,">","$ARGV[5]/wordpronunciation");
print handle1 "(set! wordstruct ' ( ";
close(handle1);
while ($start <= $count)
{
	$syl1 = tail(head(cat("syllables"),$start),1);
	open(handle,">","syl1");
	print handle $syl1."\n";
	close(handle);
	`perl scripts/ortho_to_phonetic1.pl syl1 lists/phone_list syl2`;
	$num_phones = scalar(split("\n",cat("syl2")));
	$ph_start = 1;
	#open(handle,">","syl3");
	while ($ph_start <= $num_phones)
	{
		$phn = tail(head(cat("syl2"),$ph_start),1);
		`echo 0.1 125 $phn >> lab/1.lab`;
		#open(handle,">","syl3");
		if ($ph_start == 1)
		{
			open(handle,">","syl3");
			print handle $phn." ";
			close(handle);
		}
		elsif($ph_start < $num_phones)
		{
			open(handle,">>","syl3");
			print handle $phn." ";
			close(handle);
		}
		else
		{
			open(handle,">>","syl3");
			print handle $phn;
			close(handle);
		}
		$ph_start++;
	}
	#close(handle);
	$syl = cat("syl3");
	open(handle2,">>","$ARGV[5]/wordpronunciation");
	print handle2 "(($syl) 0)";
	print handle2 " ";
	close(handle2);
	$start++;
}
open(handle3,">>","$ARGV[5]/wordpronunciation");
print handle3 ") )";
close(handle3);
open(handle4,">","morph_tag1");
print handle4 "(set! a ".'"'."0".'")';
close(handle4);
#unlink(word);
unlink("prompt-lab/bi_1.lab");
sub cat
{
	$val="";
	$file = $_[0];
	open (input, "<",$file) ||die;
	while(<input>)
	{
		#print $_;
		$val.="$_";
	}
	#print $val;
	return $val;
	close (input);
}
sub head
{
	$text_head="";
	@text_h_split = split("\n",$_[0]);
	$line_h = $_[1];
	$i =0;
	while($i < $line_h)
	{
		#$text_new = join("\n",$text_new,$text[$i]);
		#$text_head.="$text_h_split[$i]";
		if($i < $line_h-1)
		{
			$text_head.="$text_h_split[$i]\n";
		}
		elsif($i == $line_h-1)
		{
			$text_head.="$text_h_split[$i]";
		}
		$i++;
	}
	return $text_head;
}
sub tail
{
	$text_tail="";
	@text_t_split = split("\n",$_[0]);
	$line_t = $_[1];
	$total = scalar(@text_t_split);
	$start_t = $total - $line_t;
	while($start_t <$total)
	{
		#$text_new = join("\n",$text_new,$text[$start_t]);
		#$text_tail.="$text_t_split[$start_t]\n";
		if($start_t<$total-1)
		{
			$text_tail.="$text_t_split[$start_t]\n";
		}
		elsif($start_t==$total-1)
		{
			$text_tail.="$text_t_split[$start_t]";
		}
		$start_t++;
	}
	return $text_tail;
}