Changeset 3142
- Timestamp:
- 12/14/07 20:26:42 (5 years ago)
- Location:
- lang/perl/PDIC-Converter/trunk
- Files:
-
- 7 added
- 3 removed
- 3 modified
-
README.TXT (modified) (1 diff)
-
README.eijiro3 (added)
-
convert-all-to-eview.sh (deleted)
-
convert-all-to-pdic1line.sh (deleted)
-
eijiro3-to-1line.sh (added)
-
eijiro3-to-eview.sh (added)
-
lib/Dictionary/PDIC.pm (modified) (4 diffs)
-
lib/Dictionary/PDIC/Dump.pm (modified) (7 diffs)
-
lib/Encode (added)
-
lib/Encode/BOCU1.pm (added)
-
pdic-dump.pl (deleted)
-
pdic-to-1line.pl (added)
-
pdic-to-leopard.pl (added)
Legend:
- Unmodified
- Added
- Removed
-
lang/perl/PDIC-Converter/trunk/README.TXT
r2727 r3142 1 �������@pdic-conv version 0. 1.1 (2007-12-07��1 �������@pdic-conv version 0.2 (2007-12-14�� 2 2 3 3 ���������H 4 �@�u�p���Y ���Łv�i�A���N���j�����̎����f�[�^���@�EPDIC�o�C�i���`������IC�P�s�e�L�X�g�`�� (pdic1line)5 �@�@�E �u�p���Y�r���[�A�v�ł������� (eview)4 PDIC�`���̎������@�E�P�s�e�L�X�g�`�� (pdic-to-1line.pl) 5 �@�@�E[NEW!] Mac OS X Leopard�́u�����v�`�� (pdic-to-leopard.pl) 6 6 �@�ɕϊ������N���v�g�ł��B 7 7 8 �@�ȉ� <format> ������ic1line �܂���eview �ɓǂݑւ��ĉ������B 8 �@�u�p���Y ���Łv�i�A���N���j�����̎����f�[�^���@�EPDIC�o�C�i���`������IC�P�s�e�L�X�g�`�� 9 �@�@�E�u�p���Y�r���[�A�v�ł������� 10 �@�ɕϊ������N���v�g�������Ă��܂��B 11 �@�ڂ�����README.eijiro3 ������B 12 13 �@Leopard�`���ւ̕ϊ��́u�Ƃ肠�����v�ł��B 14 �@�����L���⑼�̃G���g���[�ւ̃����N�Ȃǂ̏��͂܂�����܂����@�i�����L����IL-IPA�R�[�h����F-8�ɕϊ������v����C++�̃��C�u���������ŋ߁X�ڐA���܂��j 9 15 10 16 ���g�p��Ƃ� 11 17 �@�t���[�E�F�A�ł��B���ۏł��B 12 13 �@CPAN�ɍڂ������ō����������C�u���������Ă��܂��B���C�Z���X��erl���C�Z���X�ɂ������ł��� 14 �@�Ƃ肠�����z�z�͍T���Ă����������L��ł��B 15 16 �@��Encode::BOCU-1 �Ƃ������C�u�����i�ٍ��ƍ��킹�Ďg����Unicode (BOCU-1) ��DIC�������߂����ł��B 18 �@CPAN�ɍڂ������ō����������C�u���������Ă��܂��B���C�Z���X��erl���C�Z���X�ŁB 17 19 18 20 ���Ƃ肠�����K�v�Ȃ� 19 �@�u�p���Y ���Łv�i�A���N���j 20 21 �@���p���Y�̃e�L�X�g�f�[�^���~���������Ȃ�P�ōŐV�f�[�^��T�`���Ŕ���Ă܂��̂ł��������������������B 22 �@http://www.eijiro.jp/ 23 �@���̏ꍇ���̃c�[���͕s�v�ł��B 21 �@�ϊ�������PDIC�`���̎����B 22 �@Leopard�́u�����v�`���ɕϊ��������́ALeopard�̃C���X�g�[���f�B�X�N�Ɋ܂܂��J���c�[����ɃC���X�g�[�������v���������B 24 23 25 24 �������� 26 �@Mac OS X �́u�p���Y ���Łv�����삷���[�W�����Ȃ炽�Ԃ�ł��BOS X�t����erl�ōs���܂��B 27 �@��Windows ���̑���OS �Ŏg���ꍇ��convert-all-***.sh ��DICT_DIR ��X���������ĉ������B���Ԃ��܂��B 25 �@Mac OS X 10.5.1�ȍ~�𐄏� 28 26 29 ���g����i�P�j�u�p���Y ���Łv�̃C���X�g�[���ʼnp���Y�f�[�^����X�g�[�� 30 �@�@�@�@�f�X�N�g�b�v��PDICViewer1024EE �Ƃ����t�H���_���ł��܂��B 31 �@�i�Q�j���̃c�[��������i�z�[���f�B���N�g�������j�ɓW�J���Aconvert-all-<format>.sh �𑖂点�� 27 ���g�����@% perl pdic-to-1line.pl PDIC���� sjis ��Shift_JIS�ŕۑ��B(Ver.4�����̂� 28 �@�@% perl pdic-to-1line.pl PDIC���� ��UTF-8�ŕۑ��B(Unicode�����͂����� 29 �@�@% perl pdic-to-leopard.pl PDIC���� 30 �@�@% perl pdic-to-leopard.pl PDIC���� �t�H���g�t�@�~���[�� �����o�����\���t�H���g(CSS�p) 32 31 33 �@�@% cd ~ 34 �@�@% tar zxf pdic-conv-0.1.1.tar.gz 35 �@�@% cd pdic-conv 36 �@�@% ./convert-all-<format>.sh 37 �@�@[eijiro98] 38 �@�@[reiji98] 39 �@�@[ryaku98] 40 �@�@[waeiji98] 41 �@�@% 32 �����ӎ��� 42 33 43 �@�i�Q�j�����Ǝ��Ԃ��������ŋx�e�B�R�[�q�[��[�{�[�h�ɂ��ڂ��Ȃ��悤�ɁB 44 �@�i�R�j~/pdic-conv/ ���@�@�@�@�@eijiro98.txt, reiji98.txt, ryaku98.txt, waeiji98.txt 45 �@�@�@�@�Ƃ����t�@�C�����ł����ŁA���ς������Ȃ��E�E���D���Ȃ悤�ɁB 34 �@�A���N���u�p���Y�@���Łv�ɓ�����������IC���������ϊ��ł��܂����AGB�P�ʂɂȂ����@�f�B�X�N�e�ʂɂ��Ȃ����肪�K�v�ł��B���Ԃ������i�\�����H���\���H�j���������B 35 �@���̂������̃c�[�����̂��o�[�W�����A�b�v�����ŁA�����̂͂��ꂩ�����Ă����͂������� 36 �@�Ȃ��A�e�L�X�g�`���̉p���Y��pard�`���ɕϊ������́A���̃c�[���ł͂Ȃ� 37 �@�@http://www.binword.com/blog/archives/000569.html 38 �@�̋L�����Q�l�ɂȂ邩�Ǝv���܂��B 46 39 47 ������version 0.1.1 ���Q����Ƃ߁A����tsune����007/5/9�̃p�b�`��p 40 ������version 0.2 Leopard�̎����`���ɑΉ� 41 version 0.1.1 ���Q����Ƃ߁A����tsune����007/5/9�̃p�b�`��p 48 42 < http://subtech.g.hatena.ne.jp/otsune/20070509/EIJIROPDICConverterDiff 49 43 �@version 0.1 (2007-02-12�� -
lang/perl/PDIC-Converter/trunk/lib/Dictionary/PDIC.pm
r2727 r3142 9 9 10 10 use Dictionary::PDIC::Dump; 11 12 use Digest::SHA1 qw(sha1_hex); 11 13 12 14 ##use utf8; … … 497 499 # 498 500 sub render_field { 499 my ($self,$ ref_field,$output_encoding,$output_format) = @_;501 my ($self,$fh,$ref_field,$output_encoding,$output_format) = @_; 500 502 # my $is_bocu = $self->is_bocu; 501 503 … … 523 525 $trans =~ s/\015\n/ \\ /g; 524 526 525 print f("%s\n", $entry);527 print $fh "$entry\n"; 526 528 if ($example) { 527 print f("%s / %s\n", $trans, $example);529 print $fh "$trans / $example\n"; 528 530 } else { 529 print f("%s\n", $trans);531 print $fh "$trans\n"; 530 532 } 531 533 } elsif ($output_format eq 'PDIC-1LINE') { 532 534 $trans =~ s/\015\n/ \\ /g; 533 535 if ($example) { 534 print f("%s /// %s / %s\n", $entry, $trans, $example);536 print $fh "$entry /// $trans / $example\n"; 535 537 } else { 536 print f("%s /// %s\n", $entry, $trans);538 print $fh "$entry /// $trans\n"; 537 539 } 538 540 } elsif ($output_format eq 'TAB') { 539 541 $trans =~ s/\015\n/ \\ /g; 540 print f("%s\t%s\t%s\n", $entry, $trans, $example);542 print $fh "$entry\t$trans\t$example\n"; 541 543 } elsif ($output_format eq 'CSV') { 542 544 # $trans =~ s/\015\n/ \\ /g; 543 545 $trans =~ s/"/\\"/g; 544 printf("\"%s\",\"%s\",\"%s\"\n", $entry, $trans, $example); 546 print $fh "\"$entry\",\"$trans\",\"$example\"\n"; 547 } elsif ($output_format eq 'Leopard') { 548 my $id = sha1_hex($entry); 549 my $entry_escaped = $entry; 550 $entry_escaped =~ s/"/\"/g; 551 print $fh "<d:entry id=\"$id\" d:title=\"$entry_escaped\">\n"; 552 print $fh "\t<d:index d:value=\"$entry_escaped\"/>\n"; 553 print $fh "\t<h1><span class='headword'>$entry</span></h1>\n"; 554 # print $fh "\t<span d:pr=2>| $pron |</span>\n" if $pron; 555 print $fh "\t<span class='meaning'>$trans</span>\n" if $trans; 556 print $fh "\t<span class='example'>$example</span>\n" if $example; 557 print $fh "</d:entry>\n"; 545 558 } else { 546 559 if ($pron) { 547 print f("%s [%s]\n", $entry, $pron);560 print $fh "$entry [$pron]\n"; 548 561 } else { 549 print f("%s\n", $entry);562 print $fh "$entry\n"; 550 563 } 551 564 $trans =~ s/\015\n/\n\t/g; 552 print f("\t%s\n", $trans);553 print f("\t%s\n", $example);565 print $fh "\t$trans\n"; 566 print $fh "\t$example\n"; 554 567 } 555 568 } … … 560 573 sub dump { 561 574 my ($self,$output_encoding,$output_format) = @_; 562 Dictionary::PDIC::Dump::dump($self,$output_encoding,$output_format); 563 } 575 Dictionary::PDIC::Dump::dump($self,*STDOUT,$output_encoding,$output_format); 576 } 577 sub dump_fh { 578 my ($self,$fh,$output_encoding,$output_format) = @_; 579 Dictionary::PDIC::Dump::dump($self,$fh,$output_encoding,$output_format); 580 } 581 564 582 sub dump_header { 565 583 my $self = shift; 566 Dictionary::PDIC::Dump::dump_header($self );584 Dictionary::PDIC::Dump::dump_header($self,*STDOUT); 567 585 } 568 586 sub dump_index { 569 587 my ($self,$output_encoding) = @_; 570 Dictionary::PDIC::Dump::dump_index($self, $output_encoding);588 Dictionary::PDIC::Dump::dump_index($self,*STDOUT,$output_encoding); 571 589 } 572 590 sub dump_datablock { 573 591 my ($self,$phys,$output_encoding,$output_format) = @_; 574 Dictionary::PDIC::Dump::dump_datablock($self, $phys,$output_encoding,$output_format);592 Dictionary::PDIC::Dump::dump_datablock($self,*STDOUT,$phys,$output_encoding,$output_format); 575 593 } 576 594 -
lang/perl/PDIC-Converter/trunk/lib/Dictionary/PDIC/Dump.pm
r2727 r3142 8 8 # 9 9 sub dump { 10 my ($pdic,$ output_encoding,$output_format) = @_;10 my ($pdic,$fh,$output_encoding,$output_format) = @_; 11 11 12 12 my $cnt = 0; … … 18 18 for (my $i=0; $i<=$#index; $i+=2) { 19 19 my $phys = $index[$i]; 20 dump_datablock( $pdic, $phys, $output_encoding, $output_format);20 dump_datablock($pdic,$fh,$phys,$output_encoding,$output_format); 21 21 } 22 22 } … … 26 26 # 27 27 sub dump_header { 28 my $pdic = shift; 28 # my $pdic = shift; 29 my ($pdic,$fh) = @_; 29 30 30 31 my %header = $pdic->header; 31 32 while ((my $key, my $value) = each(%header)) { 32 printf("%s => %s\n", $key, $value);33 printf $fh "%s => %s\n", $key, $value; 33 34 } 34 35 } … … 38 39 # 39 40 sub dump_index { 40 my ($pdic,$ output_encoding) = @_;41 my ($pdic,$fh,$output_encoding) = @_; 41 42 unless ($output_encoding) { 42 43 $output_encoding = $pdic->is_bocu ? 'utf8' : 'shiftjis'; … … 52 53 Encode::from_to($entry, $dict_encoding, $output_encoding); 53 54 } 54 printf ("- phys=%d entry=\"%s\"\n", $index[$i], $entry);55 printf $fh, "- phys=%d entry=\"%s\"\n", $index[$i], $entry; 55 56 } 56 57 } … … 60 61 # 61 62 sub dump_datablock { 62 my ($pdic,$ phys,$output_encoding,$output_format) = @_;63 my ($pdic,$fh,$phys,$output_encoding,$output_format) = @_; 63 64 64 65 my @result = (); … … 69 70 70 71 foreach my $ref_field (@result) { 71 $pdic->render_field($ ref_field,$output_encoding,$output_format);72 $pdic->render_field($fh,$ref_field,$output_encoding,$output_format); 72 73 } 73 74 }
![(please configure the [header_logo] section in trac.ini)](/share/chrome/site/your_project_logo.png)