Module: Kotoshu::Language::Suika

Defined in:
lib/kotoshu/language/suika.rb

Overview

Soft-load suika. The gem is intentionally NOT a hard runtime dependency — its native extension (dartsclone) fails to build on slim/minimal environments and would block install for users who only want non-Japanese spell-checking. Japanese tokenization and POS tagging light up automatically when the gem is present.

KOTOSHU_NO_SUIKA=1 forces Japanese analysis off even when the gem is installed (useful for benchmarks / CI determinism).

Constant Summary collapse

LOADED =
begin
  if ENV["KOTOSHU_NO_SUIKA"] == "1"
    false
  else
    require "suika"
    true
  end
rescue LoadError
  false
end

Class Method Summary collapse

Class Method Details

.taggerObject

Return a process-wide memoized Suika::Tagger, or raise SuikaUnavailable when the gem is missing.



30
31
32
33
34
# File 'lib/kotoshu/language/suika.rb', line 30

def tagger
  raise Kotoshu::SuikaUnavailable unless LOADED

  @tagger ||= ::Suika::Tagger.new
end