Debian Codegraph @

examples/dictionary/gene95/gene2grn.rb

raw symbols ◀ ▶ SCIP
1 Debian patch touch this file
•1 #!/usr/bin/ruby
2
3 require "json"
4
5 print(<<HEADER.chomp)
6 column_create item_dictionary gene95_desc COLUMN_SCALAR ShortText
7 column_create bigram item_dictionary_gene95_desc COLUMN_INDEX|WITH_POSITION item_dictionary gene95_desc
8 load --table item_dictionary
9 [
10 ["_key","gene95_desc"]
11 HEADER
12
13 loop do
14 raw_key = gets
15 break if raw_key.nil?
16 raw_body = gets
17
18 key = nil
19 body = nil
20 begin
21 key = raw_key.encode("UTF-8", "Windows-31J").strip
22 body = raw_body.encode("UTF-8", "Windows-31J").strip
23 rescue EncodingError
24 $stderr.puts("Ignore:")
25 $stderr.puts(" key: <#{raw_key}>")
26 $stderr.puts(" body: <#{raw_body}>")
27 next
28 end
29 puts(",")
30 print([key, body].to_json)
31 end
32 puts
33 puts("]")