Sha256: a9c28b1d5ac6b56e5741b307990ccd1611b9ff3063e49d9fbd77d92964dd2598

Contents?: true

Size: 744 Bytes

Versions: 38

Compression:

Stored size: 744 Bytes

Contents

#!/usr/bin/env ruby

require "English"
require "nkf"
require "json"

print(<<HEADER.chomp)
column_create item_dictionary edict_desc COLUMN_SCALAR ShortText
column_create bigram item_dictionary_edict_desc COLUMN_INDEX|WITH_POSITION item_dictionary edict_desc
load --table item_dictionary
[
["_key","edict_desc","kana"]
HEADER

loop do
  raw_line = gets
  break if raw_line.nil?

  line = raw_line.encode("UTF-8", "EUC-JP")
  key, body = line.strip.split("/", 2)
  key = key.strip
  if /\s*\[(.+)\]\z/ =~ key
    key = $PREMATCH
    reading = $1
    body = "[#{reading}] #{body}"
    kana = NKF.nkf("-Ww --katakana", reading)
  else
    kana = NKF.nkf("-Ww --katakana", key)
  end
  puts(",")
  puts([key, body, kana].to_json)
end
puts
puts("]")

Version data entries

38 entries across 38 versions & 1 rubygems

Version Path
rroonga-9.0.7-x64-mingw32 vendor/local/share/groonga/examples/dictionary/edict/edict2grn.rb
rroonga-9.0.7-x86-mingw32 vendor/local/share/groonga/examples/dictionary/edict/edict2grn.rb
rroonga-9.0.3-x64-mingw32 vendor/local/share/groonga/examples/dictionary/edict/edict2grn.rb
rroonga-9.0.3-x86-mingw32 vendor/local/share/groonga/examples/dictionary/edict/edict2grn.rb
rroonga-9.0.2-x64-mingw32 vendor/local/share/groonga/examples/dictionary/edict/edict2grn.rb
rroonga-9.0.2-x86-mingw32 vendor/local/share/groonga/examples/dictionary/edict/edict2grn.rb
rroonga-7.1.1-x64-mingw32 vendor/local/share/groonga/examples/dictionary/edict/edict2grn.rb
rroonga-7.1.1-x86-mingw32 vendor/local/share/groonga/examples/dictionary/edict/edict2grn.rb
rroonga-7.0.2-x86-mingw32 vendor/local/share/groonga/examples/dictionary/edict/edict2grn.rb
rroonga-7.0.2-x64-mingw32 vendor/local/share/groonga/examples/dictionary/edict/edict2grn.rb
rroonga-6.1.3-x64-mingw32 vendor/local/share/groonga/examples/dictionary/edict/edict2grn.rb
rroonga-6.1.3-x86-mingw32 vendor/local/share/groonga/examples/dictionary/edict/edict2grn.rb
rroonga-6.1.0-x86-mingw32 vendor/local/share/groonga/examples/dictionary/edict/edict2grn.rb
rroonga-6.1.0-x64-mingw32 vendor/local/share/groonga/examples/dictionary/edict/edict2grn.rb
rroonga-6.0.9-x64-mingw32 vendor/local/share/groonga/examples/dictionary/edict/edict2grn.rb
rroonga-6.0.9-x86-mingw32 vendor/local/share/groonga/examples/dictionary/edict/edict2grn.rb
rroonga-6.0.7-x86-mingw32 vendor/local/share/groonga/examples/dictionary/edict/edict2grn.rb
rroonga-6.0.7-x64-mingw32 vendor/local/share/groonga/examples/dictionary/edict/edict2grn.rb
rroonga-6.0.5-x64-mingw32 vendor/local/share/groonga/examples/dictionary/edict/edict2grn.rb
rroonga-6.0.5-x86-mingw32 vendor/local/share/groonga/examples/dictionary/edict/edict2grn.rb