#!/usr/bin/env ruby
# -*- coding: utf-8 -*-

ENV['MECAB_PATH']='/usr/lib/x86_64-linux-gnu/libmecab.so'
require './kana_Braille.rb'     
require 'natto'
#require 'kakasi'
#require 'nkf'

def mena(tem,text,b,a,se,ei,c,oo,ko)
  natto = Natto::MeCab.new
  natto.parse(text) do |n|
    k = n.feature.split(',')
    if k[0]=="BOS/EOS" #BOSは文頭を表し、EOSは文末を表す。
      #k[0]にBOS/EOSが含まれていたら空白を表示するよう指示
      tem+=""
    else
      if k[-1]=="*"
        sin="ヨメナイ"
        yousyori=youon(sin,b)
      else
        yousyori=youon(k[-1],b)
      end
      #p yousyori
      #tem+="#{yousyori}"
      #printf("%s\n",yousyori)  
      for moji in yousyori.split("")
        if moji==(" ") #空白があったら空白を出す
          #print(" ")
          tem+=""
          #if seion.include?(amoji)==false && eisu.include?(amoji)==false 
        elsif se.include?(moji)==false && ei.include?(moji)==false 
          #printf("<td>%s</td><td>%s</td>",jisho[moji][1],jisho[moji][0])
          #p tem=$1+$`
          tem+="#{a[moji][1]}#{a[moji][0]}"
        elsif oo.include?(moji)==true || ko.include?(moji)==true
          #printf("<td>%s</td>",jisho3[moji][0])
          tem+="#{c[moji][0]}"
        else
          #printf("<td>%s</td>",moji)  
          tem+="#{moji}"
        end
        #p tem
      end
    end
    #k
    #tem
  end
  #k
  tem
end

# def eika(bunsyo,temei)
#   #temei=String.new
#   kkk=Kakasi.kakasi('-Ja -Ha -Ka',bunsyo)
#   for aaa in kkk.split("")
#     if aaa=="^"
#       aaa="-"
#       temei+="#{aaa}"
#     else
#       temei+="#{aaa}"
#     end
#   end
#   temei="外"+"#{temei}"
#   temei
# end

def sutem(suuu,suji,sufu)
  j=0
  #suji=String.new
  for retu in suuu.split("")
    j+=1
    if j==1
      #printf("%s%s",jisho3.keys[76],retu)
      suji+="#{sufu}#{retu}"
    else
      #printf("%s",retu)
      suji+="#{retu}"
    end
  end
  suji
end  

