Module: JLPT::Conjugation

Defined in:
lib/jlpt/analyzers/conjugation.rb

Overview

Verb and Adjective Inflection & Conjugation Analyzer.

Identifies grammatical conjugations including te-form, causative, passive, potential, volitional, conditional, and past tense.

Class Method Summary collapse

Class Method Details

.analyze(word) ⇒ Hash

Analyze inflection type and form tags of a verb or adjective

Parameters:

  • word (String)

    conjugated Japanese verb or adjective

Returns:

  • (Hash)

    conjugation details hash



15
16
17
18
19
20
21
# File 'lib/jlpt/analyzers/conjugation.rb', line 15

def analyze(word)
  return empty_result if word.nil? || word.to_s.strip.empty?

  str = word.to_s.strip
  forms = detect_voice_forms(str) + detect_tense_and_mood_forms(str)
  { word: str, type: detect_type(str), forms: forms.uniq }
end