Module: Summarize

Included in:
String
Defined in:
lib/summarize.rb,
ext/summarize/summarize.c

Constant Summary collapse

VERSION =
"1.0.3"
LANGUAGES =
[
  'bg', # Bulgarian
  'ca', # Catalan
  'cs', # Czech
  'cy', # Welsh
  'da', # Danish
  'de', # German
  'el', # Greek
  'en', # English
  'eo', # Esperanto
  'es', # Spanish
  'et', # Creole
  'eu', # Basque
  'fi', # Finnish
  'fr', # French
  'ga', # Irish
  'gl', # Galician
  'he', # Hebrew
  'hu', # Hungarian
  'ia', # Interlingua
  'id', # Indonesian
  'is', # Icelandic
  'it', # Italian
  'lv', # Latvian
  'mi', # Maori
  'ms', # Malay
  'mt', # Maltese
  'nl', # Dutch
  'nn', # Norweigan
  'pl', # Polish
  'pt', # Portuguese
  'ro', # Romanian
  'ru', # Russian
  'sv', # Swedish
  'tl', # Tagalog
  'tr', # Turkish
  'uk', # Ukrainian
  'yi'  # Yiddish
]

Class Method Summary collapse

Class Method Details

.parse_options(options = {}) ⇒ Object

:nodoc:



55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
# File 'lib/summarize.rb', line 55

def self.parse_options(options = {}) #:nodoc:
  default_options = {
    :ratio => 25,      # percentage
    :language => 'en', # ISO 639-1 code
    :topics => false
  }

  options = default_options.merge(options.symbolize_keys)

  if options.key? :dictionary
    dict_file = options[:dictionary]
  else
    raise "Language not supported" unless LANGUAGES.index(options[:language])
    dict_file = File.join(File.expand_path(File.dirname(__FILE__)), "../ext/summarize/dic/#{options[:language]}")
  end

  return [dict_file, options[:ratio], options[:topics]]
end

.summarizeObject