/usr/bin/prime-dict-index is in prime 1.0.0.1-2.
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 | #!/usr/bin/env ruby
# prime-dict-index: A dictionary indexer for a PRIME dictionary.
# $Id: prime-dict-index.src,v 1.2 2004/03/25 17:19:51 komatsu Exp $
#
# Copyright (C) 2003 Hiroyuki Komatsu <komatsu@taiyaki.org>
# All rights reserved.
# This is free software with ABSOLUTELY NO WARRANTY.
#
# You can redistribute it and/or modify it under the terms of
# the GNU General Public License version 2.
PRIME_LIBDIR = '/usr/lib/ruby/1.8'
$LOAD_PATH.unshift(PRIME_LIBDIR) unless $LOAD_PATH.member?(PRIME_LIBDIR)
require 'prime/taiyaki'
require 'getoptlong'
require 'prime/makedict/basicdict'
class PrimeDictIndexCommand
include Debug
def initialize (command_name)
@debug_mode = false
@indexing = true
@conversion = true
@output_dictname = nil
@is_interactive = true
@command_name = command_name
@version = '1.0.0.1'
@usage = <<"EOF"
#{@command_name}:#{@version} -- indexes a PRIME dictionary.
Usage: #{@command_name} target_dictname [options]
-q, --quiet : run this command and show nothing.
-v, --version : show the version and exit
-h, --help : show this help and exit
-d, --debug : run under debug mode
EOF
end
def main ()
parse_options()
if @output_dictname.nil? then
print_usage()
exit()
end
index_dict()
end
def index_dict ()
indexer = PrimeBasicdict.new(@output_dictname, @is_interactive)
indexer.make_pos_table()
indexer.make_basicdict_indexes()
end
def print_version ()
puts "#{@command_name}:#{@version}"
end
def print_usage ()
puts @usage
end
private
def parse_options ()
options = {}
parser = GetoptLong.new()
parser.set_options(['--help', '-h', GetoptLong::NO_ARGUMENT],
['--version', '-v', GetoptLong::NO_ARGUMENT],
['--debug', '-d', GetoptLong::NO_ARGUMENT],
['--quiet', '-q', GetoptLong::NO_ARGUMENT]
)
parser.each_option {|option, arg|
options[option.sub(/^--/, '')] = arg
}
if options['version'] then
print_version()
exit()
elsif options['help'] then
print_usage()
exit()
end
if options['debug'] then
$DEBUG = true
end
@output_dictname = ARGV[0]
if options['quiet'] then
@is_interactive = false
end
end
end
if File::expand_path($0) == File::expand_path(__FILE__) then
conv_command = PrimeDictIndexCommand.new(File::basename($0))
conv_command.main()
end
|