Sha256: 31fb856de6c0fbc1fbf10c71265f956430d2ed953a1417d50a9188e4e9d33b51
Contents?: true
Size: 699 Bytes
Versions: 1
Compression:
Stored size: 699 Bytes
Contents
require 'yaml' require 'katsuyoujin/version' require 'katsuyoujin/verb' require 'katsuyoujin/base' require 'katsuyoujin/analyzer' module Katsuyoujin CONJUGATIONS = { 'ichidan' => YAML.load_file('rules/ichidan/conjugations.yml'), 'godan' => YAML.load_file('rules/godan/conjugations.yml') } def self.conjugate(word, *args, category: nil, hiragana: true) verb = Verb.new word vcat = category || verb.category rules = args.inject(CONJUGATIONS[vcat]) { |conjugations, rule| conjugations[rule] || {} } return unless rules['base'] base = Base.new(verb, rules['base']).conjugate category: category, hiragana: hiragana base + rules['attachment'] end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
katsuyoujin-0.0.1.1 | lib/katsuyoujin.rb |