/usr/bin/cassie is in ruby-cassiopee 0.1.13-1.
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 | #!/usr/bin/ruby
require 'cassiopee'
require 'optparse'
require 'logger'
options = {}
optparse = OptionParser.new do|opts|
# Set a banner, displayed at the top
# of the help screen.
opts.banner = "Usage: cassie.rb [options]"
options[:verbose] = false
opts.on( '-v', '--verbose', 'Output more information' ) do
options[:verbose] = true
end
options[:filter] = nil
opts.on( '-f', '--filter FILTER', 'Filter matches between min and max positions ex. 100-150' ) do |filter|
options[:filter] = filter
end
options[:file] = nil
opts.on( '-i', '--index FILE', 'File to index' ) do |file|
options[:file] = file
end
options[:fpattern] = nil
opts.on( '--fpattern FILE', 'File with pattern' ) do |file|
options[:fpattern] = file
end
options[:pattern] = nil
opts.on( '-p', '--pattern PATTERN', 'Search pattern' ) do |file|
options[:pattern] = file
end
options[:store] = nil
opts.on( '-s', '--store FILE', 'Store index to file' ) do |file|
options[:store] = file
end
options[:name] = nil
opts.on( '-n', '--name NAME', 'name of index, default [crawler]' ) do |name|
options[:name] = name
end
options[:exact] = false
opts.on( '-x', '--exact', 'Do exact search (default)' ) do
options[:exact] = true
end
options[:error] = 0
opts.on( '-m', '--hamming ERROR', 'Maximum number of error to search with Hamming distance' ) do |error|
options[:error] = error
end
opts.on( '-e', '--edit ERROR', 'Maximum number of error to search with edit(levenshtein) distance' ) do |error|
options[:error] = error * (-1)
end
opts.on( '-h', '--help', 'Display this screen' ) do
puts opts
exit
end
end
optparse.parse!
if(options[:file]==nil)
puts "Error, input file is missing, use -h option for usage"
exit
elif(options[:verbose])
puts "Input sequence: " << options[:file].to_s
end
if(options[:fpattern]==nil && options[:pattern]==nil)
puts "Error, pattern is missing, use -h option for usage"
exit
end
if(options[:error]==0)
options[:exact] = true
end
crawler = Cassiopee::Crawler.new
crawler.setLogLevel(Logger::INFO)
if(options[:store])
crawler.use_store = true
end
if(options[:name]!=nil)
crawler.file_suffix = options[:name]
end
if(options[:filter]!=nil)
positions = options[:filter].split('-')
crawler.filter_position(positions[0],positions[1])
end
# String to index
crawler.indexFile(options[:file])
matches = nil
if(options[:fpattern]==nil)
pattern = options[:pattern]
else
pattern = ''
file = File.new(options[:fpattern], "r")
while (line = file.gets)
input = line.downcase.chomp
pattern << input
end
file.close
if(pattern.length==0)
puts "Error pattern file is empty"
exit
end
end
if(options[:verbose])
puts "Search pattern " << pattern
end
if(options[:exact])
puts "Search exact" unless !options[:verbose]
matches = crawler.searchExact(pattern)
else
puts "Search approximate" unless !options[:verbose]
matches = crawler.searchApproximate(pattern,options[:errors])
end
# Go through matches
while((match = crawler.next())!=nil)
puts "Match: " << match.inspect
end
|