4
# ctdicconv.rb -- convert china_taiwan.csv to SKK-JISYO dictionary format.
6
# Copyright (C) 2002 NAKAJIMA Mikio <minakaji@osaka.email.ne.jp>
8
# Author: NAKAJIMA Mikio <minakaji@osaka.email.ne.jp>
10
# Last Modified: $Date: 2002/08/01 21:39:37 $
11
# Version: $Id: ctdicconv.rb,v 1.1 2002/08/01 21:39:37 minakaji Exp $
13
# This file is part of Daredevil SKK.
15
# Daredevil SKK is free software; you can redistribute it and/or modify
16
# it under the terms of the GNU General Public License as published by
17
# the Free Software Foundation; either versions 2, or (at your option)
20
# Daredevil SKK is distributed in the hope that it will be useful
21
# but WITHOUT ANY WARRANTY; without even the implied warranty of
22
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23
# GNU General Public License for more details.
25
# You should have received a copy of the GNU General Public License
26
# along with Daredevil SKK, see the file COPYING. If not, write to the
27
# Free Software Foundation Inc., 59 Temple Place - Suite 330, Boston,
35
# from �֥��֥������Ȼظ�������ץȸ���ruby��p121
36
def csv_split(source, delimiter = ',')
39
source.split(delimiter).each do |d|
46
if /[^"]"$/ =~ data or '""' == data
47
csv << data.sub(/^"(.*)"$/, '\1').gsub(/""/, '"')
55
raise "cannot decode CSV\n" unless data.empty?
62
print "�ե��������ꤷ�Ʋ�����\n"
65
File.foreach(file) do |line|
70
#�������,����,�Ѹ츫�Ф�,����,���ܸ��ɤ�,�����ɤߡʥ������ʡ�,�Ѹ�ɸ��2,������̾,������̾�ɤ�,����,�����ɤ�,annotation
71
c_t,d,e_key,kanji,j_key,c_key,english,kanji_alias,kanji_alias_key,capital,capital_key,annotation= csv_split(line.chomp)
72
if (e_key && !e_key.empty? && kanji && !kanji.empty?)
76
if ($ANNOTATION && annotation && !annotation.empty?)
78
print e_key, " /", kanji, ";", annotation, "/\n"
80
print e_key, " /", kanji, "/\n"
83
# ���ܸ츫�Ф� /Capitalized �Ѹ�/
84
if (j_key && !j_key.empty?)
86
if ($ANNOTATION && annotation && !annotation.empty?)
88
print j_key, " /", e_key.capitalize, ";", annotation, "/\n"
90
print j_key, " /", e_key.capitalize, "/\n"
95
if (j_key && !j_key.empty? && kanji && !kanji.empty?)
97
if ($ANNOTATION && annotation && !annotation.empty?)
99
print j_key, " /", kanji, ";", annotation, "/\n"
101
print j_key, " /", kanji, "/\n"
105
if (c_key && !c_key.empty? && kanji && !kanji.empty?)
107
c_key.tr!("��-��", "��-��")
109
if ($ANNOTATION && annotation && !annotation.empty?)
110
print c_key, " /", kanji, ";", annotation, "/\n"
112
print c_key, " /", kanji, "/\n"
115
# ������̾���Ф� /������̾/
116
if (kanji_alias && kanji_alias_key &&
117
!kanji_alias.empty? && !kanji_alias_key.empty?)
118
if ($ANNOTATION && annotation && !annotation.empty?)
119
print kanji_alias_key, " /", kanji_alias, ";", annotation, "/\n"
121
print kanji_alias_key, " /", kanji_alias, "/\n"
125
#if (capital && capital_key &&
126
# !capital.empty? && !capital_key.empty?)
127
# print capital_key, " /", capital, "/\n"
132
# end of ctdicconv.rb