This file is indexed.

/usr/share/skktools/convert2skk/prime2skk.rb is in skktools 1.3.3-2+b1.

This file is owned by root:root, with mode 0o755.

The actual contents of the file can be viewed below.

  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
#!/usr/bin/ruby -Ke
# -*- coding: euc-jp -*-
## Copyright (C) 2005 MITA Yuusuke <clefs@mail.goo.ne.jp>
##
## Author: MITA Yuusuke <clefs@mail.goo.ne.jp>
## Maintainer: SKK Development Team <skk@ring.gr.jp>
## Version: $Id: prime2skk.rb,v 1.6 2013/05/26 09:47:48 skk-cvs Exp $
## Keywords: japanese, dictionary
## Last Modified: $Date: 2013/05/26 09:47:48 $
##
## This program is free software; you can redistribute it and/or modify
## it under the terms of the GNU General Public License as published by
## the Free Software Foundation; either version 2, or (at your option)
## any later version.

## This program is distributed in the hope that it will be useful,
## but WITHOUT ANY WARRANTY; without even the implied warranty of
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
## General Public License for more details.

## You should have received a copy of the GNU General Public License
## along with this program, see the file COPYING.  If not, write to the
## Free Software Foundation Inc., 51 Franklin St, Fifth Floor, Boston,
## MA 02110-1301, USA.
##
### Instruction:
##
## This script tries to convert PRIME dictionary files into skk ones.
##
##    % prime2skk.rb prime-dict | skkdic-expr2 > SKK-JISYO.prime
##
##    % prime2skk.rb -Ag prime-dict | conjugation.rb -opUC | skkdic-expr2 > SKK-JISYO.prime.conjugation
##
## -g and -A given, this script can append grammatical annotations useful in
## combination with conjugation.rb.
## 
## NOTE: skkdictools.rb should be in one of the ruby loadpaths.
##
require 'jcode' if RUBY_VERSION.to_f < 1.9
#require 'kconv'
require 'skkdictools'
require 'optparse'
opt = OptionParser.new

skip_identical = true
skip_hira2kana = true
grammar = false
asayake_mode = "none"
unannotate = false

opt.on('-a', "convert Asayake into AsayaKe") { asayake_mode = "convert" }
opt.on('-A', "both Asayake and AsayaKe are output") { asayake_mode = "both" }
opt.on('-g', "append grammatical annotations") { grammar = true }
opt.on('-k', "generate hiragana-to-katakana pairs (¡Ö¤Í¤³ /¥Í¥³/¡×)") { skip_hira2kana = false }
opt.on('-K', "generate identical pairs (¡Ö¤Í¤³ /¤Í¤³/¡×)") { skip_identical = false }
opt.on('-u', "don't add original comments as annotation") { unannotate = true }

begin
  opt.parse!(ARGV)
rescue OptionParser::InvalidOption => e
  print "'#{$0} -h' for help.\n"
  exit 1
end

while gets
  #line = $_.toeuc
  key, hinsi, candidate, score, notes = $_.split("	", 5)
  # ¤¸¤ç¤¦¤¿¤¤	̾»ì	¾õÂÖ	377	comment=state	usage=¤â¤Î¤´¤È¤ÎÍͻҡ£¡Ö¾õÂÖÊѲ½¡×
  next if skip_identical && key == candidate
  next if skip_hira2kana && key.to_katakana == candidate

  comment = nil
  if grammar
    comment = hinsi
    comment += "[¦Õ>]" if hinsi =~ /ÀÜƬ¸ì/
    comment += "[¦Õ#]" if hinsi =~ /½õ¿ô»ì/
    comment += "[¦Õ<]" if hinsi =~ /ÀÜÈø¸ì/
  end

  print_orig = true
  okuri = ""
  comment_extra = ""
  notes.chop!.gsub!(/	/, ",") if !notes.nil?

  if asayake_mode != "none"
    new_key, new_candidate, postfix = okuri_nasi_to_ari(key, candidate)
    if !new_key.nil?
      if grammar
	comment_extra += "(-#{postfix})"

	if (hinsi =~ /̾»ì/ ||
	    hinsi =~ /Éû»ì/ ||
	    hinsi =~ /Ï¢Âλì/ ||
	    hinsi =~ /ÂθÀ/ )
	  print_orig = true
	else
	  print_orig = false
	end
      end
      print_pair(new_key, new_candidate, unannotate ? nil : notes,
		  comment.delete("¦Õ") + comment_extra)
      print_orig = false if asayake_mode != "both"
    elsif grammar
      # XXX XXX Unfortunately, prime-dict doesn't have data of exact
      # conjugation types for adjective verbs; this should yield a lot of
      # unwanted okuri-ari pairs, such as ¡Ö¤É¤¦¤É¤¦n /Ʋ¡¹/¡×(¥¿¥ê³èÍÑ).
      comment += "[¦Õdn(st)]" if hinsi =~ /·ÁÍÆÆ°»ì/
      comment += "[¦Õs]" if hinsi =~ /¥µ¹Ô\(¤¹¤ë\)/

      if hinsi =~ /([¥¢-¥ó])¹Ô¸ÞÃÊ/
	okuri = GyakuhikiOkurigana.assoc($1.to_hiragana)[1]
      end

      if hinsi =~ /·ÁÍÆ»ì/
	comment += "[iks(gm)]" 
	okuri = "i"
      elsif hinsi =~ /¥ï¹Ô¸ÞÃÊ/
	comment += "[wiueot(c)]"
	okuri = "u"
      elsif hinsi =~ /¥¬¹Ô¸ÞÃÊ/
	comment += "[gi]"
      elsif hinsi =~ /¥«¹Ô¸ÞÃÊ/
	#if candidate =~ /¹Ô$/
	if key =~ /¤¤$/
	  comment += "[ktc]"
	elsif key =~ /¤æ$/
	  comment += "[k]"
	else
	  comment += "[ki]"
	end
      elsif hinsi =~ /¥Þ¹Ô¸ÞÃÊ/
	comment += "[mn]"
      elsif hinsi =~ /¥é¹Ô¸ÞÃÊ/
	comment += "[rt(cn)]"
      elsif hinsi =~ /Íè\(¤¯\)/
	comment += "[*]"
	okuri = "r"
      elsif hinsi =~ /°ìÃÊ/
	# this can be of problem
	comment += "[a-z]"
	okuri = "r"
      end
    end
  end
  print_pair(key + okuri, candidate, unannotate ? nil : notes, grammar ? comment : nil) if print_orig
end