Class Jmdict::ImportKanji
In: lib/jmdict/import_kanji.rb
Parent: Jmdict::Import

Import words from KanjiDic XML files into Kotoba

See www.csse.monash.edu.au/~jwb/edict_doc.html

Methods

Constants

STRATEGY_PARSER_LISTENER = 'parse_kanji_listener'   enumeration of parser types

Public Instance methods

[Source]

    # File lib/jmdict/import_kanji.rb, line 21
21:   def default_directory
22:     'kanjidic'
23:   end

[Source]

    # File lib/jmdict/import_kanji.rb, line 25
25:   def default_version
26:     '2009_03_20'
27:   end

[Source]

    # File lib/jmdict/import_kanji.rb, line 29
29:   def file_prefix
30:     'kanjidic2_'
31:   end

[Source]

    # File lib/jmdict/import_kanji.rb, line 33
33:   def file_suffix
34:     'xml'
35:   end

Import JMDict of the specified type

[Source]

    # File lib/jmdict/import_kanji.rb, line 10
10:   def import(
11:     source_location, 
12:     source_type      = Jmdict::Import::ENUM_SOURCE_XML, 
13:     source_version   = 'not_set', 
14:     maximum_imported = nil, 
15:     parser_strategy  = Jmdict::ImportKanji::STRATEGY_PARSER_LISTENER
16:   )
17:     raise "We do not know how to handle the parser strategy [#{parser_strategy}]" unless Jmdict::ImportKanji.valid_strategy?(parser_strategy)
18:     parse(source_location, source_type, source_version, maximum_imported, parser_strategy)
19:   end

[Source]

    # File lib/jmdict/import_kanji.rb, line 37
37:   def parse_kanji_listener
38:     listener = Jmdict::ImportKanjiListener.new(@_source_location, @_source_version, @_maximum_imported)
39:     return do_parse(listener)
40:   end

[Validate]