File: step1.pl

package info (click to toggle)
t-code 1%3A2.0beta9-1
  • links: PTS
  • area: main
  • in suites: potato
  • size: 1,632 kB
  • ctags: 507
  • sloc: lisp: 7,176; sh: 488; ansic: 440; perl: 270; makefile: 116
file content (44 lines) | stat: -rwxr-xr-x 946 bytes parent folder | download
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
#!/usr/local/bin/jperl

$| = 1;

sub process {
    open(IN, $_[0]) || die "$_[0] : $!";
    while (<IN>) {
	chop;
	print "." if ($n++ % 100 == 0);
	if (($yomi, $kanji, $type) = /^([^\t]+)\t+([^\t]+)\t+([^\t]+)/) {
	    next if ($kanji =~ /^[-]+$/);
	    
	    # TYPE == 1 : ư촴
	    # TYPE == 0 : ¾
	    
	    # ư졤ƻϽ߷ľ
	    if ($type =~ /(.).*/) {
		local($col) = $1;
		$col =~ tr/ޥ塞/Ĥ뤦Ť/;
		$kanji .= $col;
		$yomi .= $col;
		$type = "1";
	    } elsif (index($type, "")>=0) {
		$kanji .= "";
		$yomi .= "";
	    } elsif ($type eq "ƻ") {
		$kanji .= "";
		$yomi .= "";
	    } elsif ($type eq '0' || $type eq '2') {
		;
	    } else {
		$type = "0";
	    }
	    print OUT "$yomi:$kanji:$type\n";
	} else {
	    warn "ignore $_\n";
	}
    }
}

open(OUT, ">step1") || die "step1 : $!";
for $file ('tcode.u', 'tankan.u', 'kihon.u') {
    &process($file);
}