Jump to content

[TOPIC: topicViewTemplate]
[GLOBAL: userSmallPhoto]
Photo

??????NG????????????
Started by mascot.eric Feb 25 2013 07:17 PM

5 replies to this topic
[TOPIC CONTROLS]
This topic has been archived. This means that you cannot reply to this topic.
[/TOPIC CONTROLS]
[modOptionsDropdown]
[/modOptionsDropdown]
[reputationFilter]
[TOPIC: post.html]
#1

mascot.eric

[GLOBAL: userInfoPane.html]
mascot.eric
  • Observer

  • 3 posts
  • Corona SDK

212?????????????????????????????????????
??????????????????????????????????????????????????????????????
???????????????????????????????????????
??????????????????

?????
function wordcheck( s )
  for i = 1, #ngword do
    if s:find(ngword[i]) then
      return true
    end
  end
  return false
end
uid: 217596 topic_id: 36319 reply_id: 336319


[TOPIC: post.html]
#2

mascot.eric

[GLOBAL: userInfoPane.html]
mascot.eric
  • Observer

  • 3 posts
  • Corona SDK

?????????????
??????????????????????Lua??????????
local j = {}

local charlist = {
	a  = { romaji = "a",  hiragana = "?", katakana = "?", katakanahalf = "?", hiraganasmall = "?", katakanasmall = "?", katakanahalfsmall = "?" },
	i  = { romaji = "i",  hiragana = "?", katakana = "?", katakanahalf = "?", hiraganasmall = "?", katakanasmall = "?", katakanahalfsmall = "?" },
	u  = { romaji = "u",  hiragana = "?", katakana = "?", katakanahalf = "?", hiraganasmall = "?", katakanasmall = "?", katakanahalfsmall = "?" },
	e  = { romaji = "e",  hiragana = "?", katakana = "?", katakanahalf = "?", hiraganasmall = "?", katakanasmall = "?", katakanahalfsmall = "?" },
	o  = { romaji = "o",  hiragana = "?", katakana = "?", katakanahalf = "?", hiraganasmall = "?", katakanasmall = "?", katakanahalfsmall = "?" },
	ka = { romaji = "ka", hiragana = "?", katakana = "?", katakanahalf = "?" },
	ki = { romaji = "ki", hiragana = "?", katakana = "?", katakanahalf = "?" },
	ku = { romaji = "ku", hiragana = "?", katakana = "?", katakanahalf = "?" },
	ke = { romaji = "ke", hiragana = "?", katakana = "?", katakanahalf = "?" },
	ko = { romaji = "ko", hiragana = "?", katakana = "?", katakanahalf = "?" },
	sa = { romaji = "sa", hiragana = "?", katakana = "?", katakanahalf = "?" },
	si = { romaji = "si", hiragana = "?", katakana = "?", katakanahalf = "?" },
	su = { romaji = "su", hiragana = "?", katakana = "?", katakanahalf = "?" },
	se = { romaji = "se", hiragana = "?", katakana = "?", katakanahalf = "?" },
	so = { romaji = "so", hiragana = "?", katakana = "?", katakanahalf = "?" },
	ta = { romaji = "ta", hiragana = "?", katakana = "?", katakanahalf = "?" },
	ti = { romaji = "ti", hiragana = "?", katakana = "?", katakanahalf = "?" },
	tu = { romaji = "tu", hiragana = "?", katakana = "?", katakanahalf = "?", hiraganasmall = "?", katakanasmall = "?", katakanahalfsmall = "?" },
	te = { romaji = "te", hiragana = "?", katakana = "?", katakanahalf = "?" },
	to = { romaji = "to", hiragana = "?", katakana = "?", katakanahalf = "?" },
	na = { romaji = "na", hiragana = "?", katakana = "?", katakanahalf = "?" },
	ni = { romaji = "ni", hiragana = "?", katakana = "?", katakanahalf = "?" },
	nu = { romaji = "nu", hiragana = "?", katakana = "?", katakanahalf = "?" },
	ne = { romaji = "ne", hiragana = "?", katakana = "?", katakanahalf = "?" },
	no = { romaji = "no", hiragana = "?", katakana = "?", katakanahalf = "?" },
	ha = { romaji = "ha", hiragana = "?", katakana = "?", katakanahalf = "?" },
	hi = { romaji = "hi", hiragana = "?", katakana = "?", katakanahalf = "?" },
	hu = { romaji = "hu", hiragana = "?", katakana = "?", katakanahalf = "?" },
	he = { romaji = "he", hiragana = "?", katakana = "?", katakanahalf = "?" },
	ho = { romaji = "ho", hiragana = "?", katakana = "?", katakanahalf = "?" },
	ma = { romaji = "ma", hiragana = "?", katakana = "?", katakanahalf = "?" },
	mi = { romaji = "mi", hiragana = "?", katakana = "?", katakanahalf = "?" },
	mu = { romaji = "mu", hiragana = "?", katakana = "?", katakanahalf = "?" },
	me = { romaji = "me", hiragana = "?", katakana = "?", katakanahalf = "?" },
	mo = { romaji = "mo", hiragana = "?", katakana = "?", katakanahalf = "?" },
	ya = { romaji = "ya", hiragana = "?", katakana = "?", katakanahalf = "?", hiraganasmall = "?", katakanasmall = "?", katakanahalfsmall = "?" },
	yu = { romaji = "yu", hiragana = "?", katakana = "?", katakanahalf = "?"},
	yo = { romaji = "yo", hiragana = "?", katakana = "?", katakanahalf = "?", hiraganasmall = "?", katakanasmall = "?", katakanahalfsmall = "?" },
	ra = { romaji = "ra", hiragana = "?", katakana = "?", katakanahalf = "?" },
	ri = { romaji = "ri", hiragana = "?", katakana = "?", katakanahalf = "?" },
	ru = { romaji = "ru", hiragana = "?", katakana = "?", katakanahalf = "?" },
	re = { romaji = "re", hiragana = "?", katakana = "?", katakanahalf = "?" },
	ro = { romaji = "ro", hiragana = "?", katakana = "?", katakanahalf = "?" },
	wa = { romaji = "wa", hiragana = "?", katakana = "?", katakanahalf = "?" },
	wo = { romaji = "wo", hiragana = "?", katakana = "?", katakanahalf = "?", },
	n  = { romaji = "n ", hiragana = "?", katakana = "?", katakanahalf = "?" },
	ga = { romaji = "ga", hiragana = "?", katakana = "?", katakanahalf = "??" },
	gi = { romaji = "gi", hiragana = "?", katakana = "?", katakanahalf = "??" },
	gu = { romaji = "gu", hiragana = "?", katakana = "?", katakanahalf = "??" },
	ge = { romaji = "ge", hiragana = "?", katakana = "?", katakanahalf = "??" },
	go = { romaji = "go", hiragana = "?", katakana = "?", katakanahalf = "??" },
	za = { romaji = "za", hiragana = "?", katakana = "?", katakanahalf = "??" },
	zi = { romaji = "zi", hiragana = "?", katakana = "?", katakanahalf = "??" },
	zu = { romaji = "zu", hiragana = "?", katakana = "?", katakanahalf = "??" },
	ze = { romaji = "ze", hiragana = "?", katakana = "?", katakanahalf = "??" },
	zo = { romaji = "zo", hiragana = "?", katakana = "?", katakanahalf = "??" },
	da = { romaji = "da", hiragana = "?", katakana = "?", katakanahalf = "??" },
	di = { romaji = "di", hiragana = "?", katakana = "?", katakanahalf = "??" },
	du = { romaji = "du", hiragana = "?", katakana = "?", katakanahalf = "??" },
	de = { romaji = "de", hiragana = "?", katakana = "?", katakanahalf = "??" },
	d  = { romaji = "do", hiragana = "?", katakana = "?", katakanahalf = "??" },
	ba = { romaji = "ba", hiragana = "?", katakana = "?", katakanahalf = "??" },
	bi = { romaji = "bi", hiragana = "?", katakana = "?", katakanahalf = "??" },
	bu = { romaji = "bu", hiragana = "?", katakana = "?", katakanahalf = "??" },
	be = { romaji = "be", hiragana = "?", katakana = "?", katakanahalf = "??" },
	bo = { romaji = "bo", hiragana = "?", katakana = "?", katakanahalf = "??" },
	pa = { romaji = "pa", hiragana = "?", katakana = "?", katakanahalf = "??" },
	pi = { romaji = "pi", hiragana = "?", katakana = "?", katakanahalf = "??" },
	pu = { romaji = "pu", hiragana = "?", katakana = "?", katakanahalf = "??" },
	pe = { romaji = "pe", hiragana = "?", katakana = "?", katakanahalf = "??" },
	po = { romaji = "po", hiragana = "?", katakana = "?", katakanahalf = "??" },
	line={ romaji = "-",  hiragana = "-", katakana = "?", katakanahalf = "?", hiraganasmall = "?", katakanasmall = "~", katakanahalfsmall = "?" }
}

local charlist1 = {
	ka = { romaji = "ka", hiragana = "?", katakana = "?", katakanahalf = "?" },
	ki = { romaji = "ki", hiragana = "?", katakana = "?", katakanahalf = "?" },
	ku = { romaji = "ku", hiragana = "?", katakana = "?", katakanahalf = "?" },
	ke = { romaji = "ke", hiragana = "?", katakana = "?", katakanahalf = "?" },
	ko = { romaji = "ko", hiragana = "?", katakana = "?", katakanahalf = "?" },
	sa = { romaji = "sa", hiragana = "?", katakana = "?", katakanahalf = "?" },
	si = { romaji = "si", hiragana = "?", katakana = "?", katakanahalf = "?" },
	su = { romaji = "su", hiragana = "?", katakana = "?", katakanahalf = "?" },
	se = { romaji = "se", hiragana = "?", katakana = "?", katakanahalf = "?" },
	so = { romaji = "so", hiragana = "?", katakana = "?", katakanahalf = "?" },
	ta = { romaji = "ta", hiragana = "?", katakana = "?", katakanahalf = "?" },
	ti = { romaji = "ti", hiragana = "?", katakana = "?", katakanahalf = "?" },
	tu = { romaji = "tu", hiragana = "?", katakana = "?", katakanahalf = "?" },
	te = { romaji = "te", hiragana = "?", katakana = "?", katakanahalf = "?" },
	to = { romaji = "to", hiragana = "?", katakana = "?", katakanahalf = "?" },
	na = { romaji = "na", hiragana = "?", katakana = "?", katakanahalf = "?" },
	ni = { romaji = "ni", hiragana = "?", katakana = "?", katakanahalf = "?" },
	nu = { romaji = "nu", hiragana = "?", katakana = "?", katakanahalf = "?" },
	ne = { romaji = "ne", hiragana = "?", katakana = "?", katakanahalf = "?" },
	no = { romaji = "no", hiragana = "?", katakana = "?", katakanahalf = "?" },
	ha = { romaji = "ha", hiragana = "?", katakana = "?", katakanahalf = "?" },
	hi = { romaji = "hi", hiragana = "?", katakana = "?", katakanahalf = "?" },
	hu = { romaji = "hu", hiragana = "?", katakana = "?", katakanahalf = "?" },
	he = { romaji = "he", hiragana = "?", katakana = "?", katakanahalf = "?" },
	ho = { romaji = "ho", hiragana = "?", katakana = "?", katakanahalf = "?" },
	ma = { romaji = "ma", hiragana = "?", katakana = "?", katakanahalf = "?" },
	mi = { romaji = "mi", hiragana = "?", katakana = "?", katakanahalf = "?" },
	mu = { romaji = "mu", hiragana = "?", katakana = "?", katakanahalf = "?" },
	me = { romaji = "me", hiragana = "?", katakana = "?", katakanahalf = "?" },
	mo = { romaji = "mo", hiragana = "?", katakana = "?", katakanahalf = "?" },
	ya = { romaji = "ya", hiragana = "?", katakana = "?", katakanahalf = "?" },
	yu = { romaji = "yu", hiragana = "?", katakana = "?", katakanahalf = "?"},
	yo = { romaji = "yo", hiragana = "?", katakana = "?", katakanahalf = "?" },
	ra = { romaji = "ra", hiragana = "?", katakana = "?", katakanahalf = "?" },
	ri = { romaji = "ri", hiragana = "?", katakana = "?", katakanahalf = "?" },
	ru = { romaji = "ru", hiragana = "?", katakana = "?", katakanahalf = "?" },
	re = { romaji = "re", hiragana = "?", katakana = "?", katakanahalf = "?" },
	ro = { romaji = "ro", hiragana = "?", katakana = "?", katakanahalf = "?" },
	wa = { romaji = "wa", hiragana = "?", katakana = "?", katakanahalf = "?" },
	wo = { romaji = "wo", hiragana = "?", katakana = "?", katakanahalf = "?", },
	ga = { romaji = "ga", hiragana = "?", katakana = "?", katakanahalf = "??" },
	gi = { romaji = "gi", hiragana = "?", katakana = "?", katakanahalf = "??" },
	gu = { romaji = "gu", hiragana = "?", katakana = "?", katakanahalf = "??" },
	ge = { romaji = "ge", hiragana = "?", katakana = "?", katakanahalf = "??" },
	go = { romaji = "go", hiragana = "?", katakana = "?", katakanahalf = "??" },
	za = { romaji = "za", hiragana = "?", katakana = "?", katakanahalf = "??" },
	zi = { romaji = "zi", hiragana = "?", katakana = "?", katakanahalf = "??" },
	zu = { romaji = "zu", hiragana = "?", katakana = "?", katakanahalf = "??" },
	ze = { romaji = "ze", hiragana = "?", katakana = "?", katakanahalf = "??" },
	zo = { romaji = "zo", hiragana = "?", katakana = "?", katakanahalf = "??" },
	da = { romaji = "da", hiragana = "?", katakana = "?", katakanahalf = "??" },
	di = { romaji = "di", hiragana = "?", katakana = "?", katakanahalf = "??" },
	du = { romaji = "du", hiragana = "?", katakana = "?", katakanahalf = "??" },
	de = { romaji = "de", hiragana = "?", katakana = "?", katakanahalf = "??" },
	d  = { romaji = "do", hiragana = "?", katakana = "?", katakanahalf = "??" },
	ba = { romaji = "ba", hiragana = "?", katakana = "?", katakanahalf = "??" },
	bi = { romaji = "bi", hiragana = "?", katakana = "?", katakanahalf = "??" },
	bu = { romaji = "bu", hiragana = "?", katakana = "?", katakanahalf = "??" },
	be = { romaji = "be", hiragana = "?", katakana = "?", katakanahalf = "??" },
	bo = { romaji = "bo", hiragana = "?", katakana = "?", katakanahalf = "??" },
	pa = { romaji = "pa", hiragana = "?", katakana = "?", katakanahalf = "??" },
	pi = { romaji = "pi", hiragana = "?", katakana = "?", katakanahalf = "??" },
	pu = { romaji = "pu", hiragana = "?", katakana = "?", katakanahalf = "??" },
	pe = { romaji = "pe", hiragana = "?", katakana = "?", katakanahalf = "??" },
	po = { romaji = "po", hiragana = "?", katakana = "?", katakanahalf = "??" },
	la = { romaji = "la",  hiragana = "?", katakana = "?", katakanahalf = "?" },
	li = { romaji = "li",  hiragana = "?", katakana = "?", katakanahalf = "?" },
	lu = { romaji = "lu",  hiragana = "?", katakana = "?", katakanahalf = "?" },
	le = { romaji = "le",  hiragana = "?", katakana = "?", katakanahalf = "?" },
	lo = { romaji = "lo",  hiragana = "?", katakana = "?", katakanahalf = "?" },
	ltu= { romaji = "ltu", hiragana = "?", katakana = "?", katakanahalf = "?" },
	lya= { romaji = "lya", hiragana = "?", katakana = "?", katakanahalf = "?" },
	lyo= { romaji = "lyo", hiragana = "?", katakana = "?", katakanahalf = "?" },
	line={ romaji = "-", hiragana = "?", katakana = "?", katakanahalf = "?"},
	curl={ romaji = "~", hiragana = "?", katakana = "?", katakanahalf = "~"}
}

local charlist2 = {
	a  = { romaji = "a",  hiragana = "?", katakana = "?", katakanahalf = "?" },
	i  = { romaji = "i",  hiragana = "?", katakana = "?", katakanahalf = "?" },
	u  = { romaji = "u",  hiragana = "?", katakana = "?", katakanahalf = "?" },
	e  = { romaji = "e",  hiragana = "?", katakana = "?", katakanahalf = "?" },
	o  = { romaji = "o",  hiragana = "?", katakana = "?", katakanahalf = "?" },
	n  = { romaji = "n",  hiragana = "?", katakana = "?", katakanahalf = "?" }
}

local function checkinput( fromtype, totype )
	if (fromtype == "all" or
		fromtype == "more" or
		fromtype == "standard" or
		fromtype == "romaji" or 
		fromtype == "hiragana" or 
		fromtype == "katakana" or 
		fromtype == "katakanahalf") and
		(totype == "romaji" or
		totype == "hiragana" or
		totype == "katakana" or
		totype == "katakanahalf") then
			return true
	end
	print("wrong input:", fromtype, totype)
	return false
end

local function converter_( s, fromtype, totype )
	for i,j in pairs(charlist) do
		for k=1, s:len() do
			local start, stop
			if j[fromtype] then
				start, stop = s:find(j[fromtype])
			end
			if start and stop then
				s = s:sub(1, start-1)..j[totype]..s:sub(stop+1)
			end
		end
	end
	return s
end

local function converter( s, fromtype, totype )
	for i,j in pairs(charlist1) do
		for k=1, s:len() do
			local start, stop
			if j[fromtype] then
				start, stop = s:find(j[fromtype])
			end
			if start and stop then
				s = s:sub(1, start-1)..j[totype]..s:sub(stop+1)
			end
		end
	end
	for i,j in pairs(charlist2) do
		for k=1, s:len() do
			local start, stop
			if j[fromtype] then
				start, stop = s:find(j[fromtype])
			end
			if start and stop then
				s = s:sub(1, start-1)..j[totype]..s:sub(stop+1)
			end
		end
	end
	return s
end

function j.conv( s, fromtype, totype )
	if checkinput( fromtype, totype ) then
		if fromtype == "all" then
			s = converter( s, "hiragana", totype )
			s = converter( s, "katakana", totype )
			s = converter( s, "katakanahalf", totype )
		elseif fromtype == "more" then
			s = converter( s, "hiragana", totype )
			s = converter( s, "katakana", totype )
			s = converter( s, "katakanahalf", totype )
			s = converter( s, "romaji", totype )
		elseif fromtype == "standard" then
			s = converter_( s, "hiragana", totype )
			s = converter_( s, "katakana", totype )
			s = converter_( s, "katakanahalf", totype )
			s = converter_( s, "hiraganasmall", totype )
			s = converter_( s, "katakanasmall", totype )
			s = converter_( s, "katakanahalfsmall", totype )
		else
			s = converter( s, fromtype, totype )
		end
	end
	return s
end
function j.test( s )
	local test = {}
	test.group = display.newGroup()
	for i=1, 26 do
		test[i] = display.newText( test.group, "", 0, i*28, nil, 25)
		test[i+26] = display.newText( test.group, "", 350, i*28, nil, 25)
	end
	test.group.x, test.group.y = 50, 50
	test.string = s

	test[1].text  = "original"

	test[2].text  = "romaji -> romaji"
	test[3].text  = "hiragana -> romaji"
	test[4].text  = "katakana -> romaji"
	test[5].text  = "katakanahalf -> romaji"
	test[6].text  = "all -> romaji"
	test[7].text  = "more -> romaji"

	test[8].text  = "romaji -> hiragana"
	test[9].text  = "hiragana -> hiragana"
	test[10].text = "katakana -> hiragana"
	test[11].text = "katakanahalf -> hiragana"
	test[12].text = "all -> hiragana"
	test[13].text = "more -> hiragana"

	test[14].text = "romaji -> katakana"
	test[15].text = "hiragana -> katakana"
	test[16].text = "katakana -> katakana"
	test[17].text = "katakanahalf -> katakana"
	test[18].text = "all -> katakana"
	test[19].text = "more -> katakana"

	test[20].text = "romaji -> katakanahalf"
	test[21].text = "hiragana -> katakanahalf"
	test[22].text = "katakana -> katakanahalf"
	test[23].text = "katakanahalf -> katakanahalf"
	test[24].text = "all -> katakanahalf"
	test[25].text = "more -> katakanahalf"

	test[26].text = "standard -> hiragana"
	test[1 +26].text = test.string
	test[2 +26].text = j.conv( test.string, "romaji", "romaji")
	test[3 +26].text = j.conv( test.string, "hiragana", "romaji")
	test[4 +26].text = j.conv( test.string, "katakana", "romaji")
	test[5 +26].text = j.conv( test.string, "katakanahalf", "romaji")
	test[6 +26].text = j.conv( test.string, "all", "romaji")
	test[7 +26].text = j.conv( test.string, "more", "romaji")

	test[8 +26].text = j.conv( test.string, "romaji", "hiragana")
	test[9 +26].text = j.conv( test.string, "hiragana", "hiragana")
	test[10+26].text = j.conv( test.string, "katakana", "hiragana")
	test[11+26].text = j.conv( test.string, "katakanahalf", "hiragana")
	test[12+26].text = j.conv( test.string, "all", "hiragana")
	test[13+26].text = j.conv( test.string, "more", "hiragana")

	test[14+26].text = j.conv( test.string, "romaji", "katakana")
	test[15+26].text = j.conv( test.string, "hiragana", "katakana")
	test[16+26].text = j.conv( test.string, "katakana", "katakana")
	test[17+26].text = j.conv( test.string, "katakanahalf", "katakana")
	test[18+26].text = j.conv( test.string, "all", "katakana")
	test[19+26].text = j.conv( test.string, "more", "katakana")

	test[20+26].text = j.conv( test.string, "romaji", "katakanahalf")
	test[21+26].text = j.conv( test.string, "hiragana", "katakanahalf")
	test[22+26].text = j.conv( test.string, "katakana", "katakanahalf")
	test[23+26].text = j.conv( test.string, "katakanahalf", "katakanahalf")
	test[24+26].text = j.conv( test.string, "all", "katakanahalf")
	test[25+26].text = j.conv( test.string, "more", "katakanahalf")

	test[26+26].text = j.conv( test.string, "standard", "hiragana")

	for i=1, 26 do
		test[i]:setReferencePoint( display.TopLeftReferencePoint )
		test[i].x = 0
		test[i+26]:setReferencePoint( display.TopLeftReferencePoint )
		test[i+26].x = 350
	end

	return test
end

return j


????j.conv( string, fromtype, totype )??????????????????
fromtype:

  • "romaji"

  • "hiragana"

  • "katakana"

  • "katakanahalf

  • "all" - ?????????????

  • "more" - "all"+"romaji"

  • "standard" - ?????????????????????


totype:

  • "romaji"

  • "hiragana"

  • "katakana"

  • "katakanahalf



j.test(string)?????????????????
????????????????????????????

?
local j = require "jconv" --??????"jconv.lua"????
local s = "???????"
print( j.conv(s,"all","romaji") ) --haro-wa-rudo
j.test(s)


????????????????????????"juu"?"???"???????"jilyuu"???
"fromtype"?"totype"?????????????????????????????????????????????

????????????????????
uid: 217596 topic_id: 36319 reply_id: 144378


[TOPIC: post.html]
#3

gtatarkin

[GLOBAL: userInfoPane.html]
gtatarkin
  • Contributor

  • 366 posts
  • Corona SDK

Are you from Japan? I badly need some help on Japan market form my friend. Could you write to me?
My email address is grzegorz.tatarkin(at)gmail.com

Best regards
uid: 12704 topic_id: 36319 reply_id: 144696


[TOPIC: post.html]
#4

mascot.eric

[GLOBAL: userInfoPane.html]
mascot.eric
  • Observer

  • 3 posts
  • Corona SDK

212?????????????????????????????????????
??????????????????????????????????????????????????????????????
???????????????????????????????????????
??????????????????

?????
function wordcheck( s )
  for i = 1, #ngword do
    if s:find(ngword[i]) then
      return true
    end
  end
  return false
end
uid: 217596 topic_id: 36319 reply_id: 66319


[TOPIC: post.html]
#5

mascot.eric

[GLOBAL: userInfoPane.html]
mascot.eric
  • Observer

  • 3 posts
  • Corona SDK

?????????????
??????????????????????Lua??????????
local j = {}

local charlist = {
	a  = { romaji = "a",  hiragana = "?", katakana = "?", katakanahalf = "?", hiraganasmall = "?", katakanasmall = "?", katakanahalfsmall = "?" },
	i  = { romaji = "i",  hiragana = "?", katakana = "?", katakanahalf = "?", hiraganasmall = "?", katakanasmall = "?", katakanahalfsmall = "?" },
	u  = { romaji = "u",  hiragana = "?", katakana = "?", katakanahalf = "?", hiraganasmall = "?", katakanasmall = "?", katakanahalfsmall = "?" },
	e  = { romaji = "e",  hiragana = "?", katakana = "?", katakanahalf = "?", hiraganasmall = "?", katakanasmall = "?", katakanahalfsmall = "?" },
	o  = { romaji = "o",  hiragana = "?", katakana = "?", katakanahalf = "?", hiraganasmall = "?", katakanasmall = "?", katakanahalfsmall = "?" },
	ka = { romaji = "ka", hiragana = "?", katakana = "?", katakanahalf = "?" },
	ki = { romaji = "ki", hiragana = "?", katakana = "?", katakanahalf = "?" },
	ku = { romaji = "ku", hiragana = "?", katakana = "?", katakanahalf = "?" },
	ke = { romaji = "ke", hiragana = "?", katakana = "?", katakanahalf = "?" },
	ko = { romaji = "ko", hiragana = "?", katakana = "?", katakanahalf = "?" },
	sa = { romaji = "sa", hiragana = "?", katakana = "?", katakanahalf = "?" },
	si = { romaji = "si", hiragana = "?", katakana = "?", katakanahalf = "?" },
	su = { romaji = "su", hiragana = "?", katakana = "?", katakanahalf = "?" },
	se = { romaji = "se", hiragana = "?", katakana = "?", katakanahalf = "?" },
	so = { romaji = "so", hiragana = "?", katakana = "?", katakanahalf = "?" },
	ta = { romaji = "ta", hiragana = "?", katakana = "?", katakanahalf = "?" },
	ti = { romaji = "ti", hiragana = "?", katakana = "?", katakanahalf = "?" },
	tu = { romaji = "tu", hiragana = "?", katakana = "?", katakanahalf = "?", hiraganasmall = "?", katakanasmall = "?", katakanahalfsmall = "?" },
	te = { romaji = "te", hiragana = "?", katakana = "?", katakanahalf = "?" },
	to = { romaji = "to", hiragana = "?", katakana = "?", katakanahalf = "?" },
	na = { romaji = "na", hiragana = "?", katakana = "?", katakanahalf = "?" },
	ni = { romaji = "ni", hiragana = "?", katakana = "?", katakanahalf = "?" },
	nu = { romaji = "nu", hiragana = "?", katakana = "?", katakanahalf = "?" },
	ne = { romaji = "ne", hiragana = "?", katakana = "?", katakanahalf = "?" },
	no = { romaji = "no", hiragana = "?", katakana = "?", katakanahalf = "?" },
	ha = { romaji = "ha", hiragana = "?", katakana = "?", katakanahalf = "?" },
	hi = { romaji = "hi", hiragana = "?", katakana = "?", katakanahalf = "?" },
	hu = { romaji = "hu", hiragana = "?", katakana = "?", katakanahalf = "?" },
	he = { romaji = "he", hiragana = "?", katakana = "?", katakanahalf = "?" },
	ho = { romaji = "ho", hiragana = "?", katakana = "?", katakanahalf = "?" },
	ma = { romaji = "ma", hiragana = "?", katakana = "?", katakanahalf = "?" },
	mi = { romaji = "mi", hiragana = "?", katakana = "?", katakanahalf = "?" },
	mu = { romaji = "mu", hiragana = "?", katakana = "?", katakanahalf = "?" },
	me = { romaji = "me", hiragana = "?", katakana = "?", katakanahalf = "?" },
	mo = { romaji = "mo", hiragana = "?", katakana = "?", katakanahalf = "?" },
	ya = { romaji = "ya", hiragana = "?", katakana = "?", katakanahalf = "?", hiraganasmall = "?", katakanasmall = "?", katakanahalfsmall = "?" },
	yu = { romaji = "yu", hiragana = "?", katakana = "?", katakanahalf = "?"},
	yo = { romaji = "yo", hiragana = "?", katakana = "?", katakanahalf = "?", hiraganasmall = "?", katakanasmall = "?", katakanahalfsmall = "?" },
	ra = { romaji = "ra", hiragana = "?", katakana = "?", katakanahalf = "?" },
	ri = { romaji = "ri", hiragana = "?", katakana = "?", katakanahalf = "?" },
	ru = { romaji = "ru", hiragana = "?", katakana = "?", katakanahalf = "?" },
	re = { romaji = "re", hiragana = "?", katakana = "?", katakanahalf = "?" },
	ro = { romaji = "ro", hiragana = "?", katakana = "?", katakanahalf = "?" },
	wa = { romaji = "wa", hiragana = "?", katakana = "?", katakanahalf = "?" },
	wo = { romaji = "wo", hiragana = "?", katakana = "?", katakanahalf = "?", },
	n  = { romaji = "n ", hiragana = "?", katakana = "?", katakanahalf = "?" },
	ga = { romaji = "ga", hiragana = "?", katakana = "?", katakanahalf = "??" },
	gi = { romaji = "gi", hiragana = "?", katakana = "?", katakanahalf = "??" },
	gu = { romaji = "gu", hiragana = "?", katakana = "?", katakanahalf = "??" },
	ge = { romaji = "ge", hiragana = "?", katakana = "?", katakanahalf = "??" },
	go = { romaji = "go", hiragana = "?", katakana = "?", katakanahalf = "??" },
	za = { romaji = "za", hiragana = "?", katakana = "?", katakanahalf = "??" },
	zi = { romaji = "zi", hiragana = "?", katakana = "?", katakanahalf = "??" },
	zu = { romaji = "zu", hiragana = "?", katakana = "?", katakanahalf = "??" },
	ze = { romaji = "ze", hiragana = "?", katakana = "?", katakanahalf = "??" },
	zo = { romaji = "zo", hiragana = "?", katakana = "?", katakanahalf = "??" },
	da = { romaji = "da", hiragana = "?", katakana = "?", katakanahalf = "??" },
	di = { romaji = "di", hiragana = "?", katakana = "?", katakanahalf = "??" },
	du = { romaji = "du", hiragana = "?", katakana = "?", katakanahalf = "??" },
	de = { romaji = "de", hiragana = "?", katakana = "?", katakanahalf = "??" },
	d  = { romaji = "do", hiragana = "?", katakana = "?", katakanahalf = "??" },
	ba = { romaji = "ba", hiragana = "?", katakana = "?", katakanahalf = "??" },
	bi = { romaji = "bi", hiragana = "?", katakana = "?", katakanahalf = "??" },
	bu = { romaji = "bu", hiragana = "?", katakana = "?", katakanahalf = "??" },
	be = { romaji = "be", hiragana = "?", katakana = "?", katakanahalf = "??" },
	bo = { romaji = "bo", hiragana = "?", katakana = "?", katakanahalf = "??" },
	pa = { romaji = "pa", hiragana = "?", katakana = "?", katakanahalf = "??" },
	pi = { romaji = "pi", hiragana = "?", katakana = "?", katakanahalf = "??" },
	pu = { romaji = "pu", hiragana = "?", katakana = "?", katakanahalf = "??" },
	pe = { romaji = "pe", hiragana = "?", katakana = "?", katakanahalf = "??" },
	po = { romaji = "po", hiragana = "?", katakana = "?", katakanahalf = "??" },
	line={ romaji = "-",  hiragana = "-", katakana = "?", katakanahalf = "?", hiraganasmall = "?", katakanasmall = "~", katakanahalfsmall = "?" }
}

local charlist1 = {
	ka = { romaji = "ka", hiragana = "?", katakana = "?", katakanahalf = "?" },
	ki = { romaji = "ki", hiragana = "?", katakana = "?", katakanahalf = "?" },
	ku = { romaji = "ku", hiragana = "?", katakana = "?", katakanahalf = "?" },
	ke = { romaji = "ke", hiragana = "?", katakana = "?", katakanahalf = "?" },
	ko = { romaji = "ko", hiragana = "?", katakana = "?", katakanahalf = "?" },
	sa = { romaji = "sa", hiragana = "?", katakana = "?", katakanahalf = "?" },
	si = { romaji = "si", hiragana = "?", katakana = "?", katakanahalf = "?" },
	su = { romaji = "su", hiragana = "?", katakana = "?", katakanahalf = "?" },
	se = { romaji = "se", hiragana = "?", katakana = "?", katakanahalf = "?" },
	so = { romaji = "so", hiragana = "?", katakana = "?", katakanahalf = "?" },
	ta = { romaji = "ta", hiragana = "?", katakana = "?", katakanahalf = "?" },
	ti = { romaji = "ti", hiragana = "?", katakana = "?", katakanahalf = "?" },
	tu = { romaji = "tu", hiragana = "?", katakana = "?", katakanahalf = "?" },
	te = { romaji = "te", hiragana = "?", katakana = "?", katakanahalf = "?" },
	to = { romaji = "to", hiragana = "?", katakana = "?", katakanahalf = "?" },
	na = { romaji = "na", hiragana = "?", katakana = "?", katakanahalf = "?" },
	ni = { romaji = "ni", hiragana = "?", katakana = "?", katakanahalf = "?" },
	nu = { romaji = "nu", hiragana = "?", katakana = "?", katakanahalf = "?" },
	ne = { romaji = "ne", hiragana = "?", katakana = "?", katakanahalf = "?" },
	no = { romaji = "no", hiragana = "?", katakana = "?", katakanahalf = "?" },
	ha = { romaji = "ha", hiragana = "?", katakana = "?", katakanahalf = "?" },
	hi = { romaji = "hi", hiragana = "?", katakana = "?", katakanahalf = "?" },
	hu = { romaji = "hu", hiragana = "?", katakana = "?", katakanahalf = "?" },
	he = { romaji = "he", hiragana = "?", katakana = "?", katakanahalf = "?" },
	ho = { romaji = "ho", hiragana = "?", katakana = "?", katakanahalf = "?" },
	ma = { romaji = "ma", hiragana = "?", katakana = "?", katakanahalf = "?" },
	mi = { romaji = "mi", hiragana = "?", katakana = "?", katakanahalf = "?" },
	mu = { romaji = "mu", hiragana = "?", katakana = "?", katakanahalf = "?" },
	me = { romaji = "me", hiragana = "?", katakana = "?", katakanahalf = "?" },
	mo = { romaji = "mo", hiragana = "?", katakana = "?", katakanahalf = "?" },
	ya = { romaji = "ya", hiragana = "?", katakana = "?", katakanahalf = "?" },
	yu = { romaji = "yu", hiragana = "?", katakana = "?", katakanahalf = "?"},
	yo = { romaji = "yo", hiragana = "?", katakana = "?", katakanahalf = "?" },
	ra = { romaji = "ra", hiragana = "?", katakana = "?", katakanahalf = "?" },
	ri = { romaji = "ri", hiragana = "?", katakana = "?", katakanahalf = "?" },
	ru = { romaji = "ru", hiragana = "?", katakana = "?", katakanahalf = "?" },
	re = { romaji = "re", hiragana = "?", katakana = "?", katakanahalf = "?" },
	ro = { romaji = "ro", hiragana = "?", katakana = "?", katakanahalf = "?" },
	wa = { romaji = "wa", hiragana = "?", katakana = "?", katakanahalf = "?" },
	wo = { romaji = "wo", hiragana = "?", katakana = "?", katakanahalf = "?", },
	ga = { romaji = "ga", hiragana = "?", katakana = "?", katakanahalf = "??" },
	gi = { romaji = "gi", hiragana = "?", katakana = "?", katakanahalf = "??" },
	gu = { romaji = "gu", hiragana = "?", katakana = "?", katakanahalf = "??" },
	ge = { romaji = "ge", hiragana = "?", katakana = "?", katakanahalf = "??" },
	go = { romaji = "go", hiragana = "?", katakana = "?", katakanahalf = "??" },
	za = { romaji = "za", hiragana = "?", katakana = "?", katakanahalf = "??" },
	zi = { romaji = "zi", hiragana = "?", katakana = "?", katakanahalf = "??" },
	zu = { romaji = "zu", hiragana = "?", katakana = "?", katakanahalf = "??" },
	ze = { romaji = "ze", hiragana = "?", katakana = "?", katakanahalf = "??" },
	zo = { romaji = "zo", hiragana = "?", katakana = "?", katakanahalf = "??" },
	da = { romaji = "da", hiragana = "?", katakana = "?", katakanahalf = "??" },
	di = { romaji = "di", hiragana = "?", katakana = "?", katakanahalf = "??" },
	du = { romaji = "du", hiragana = "?", katakana = "?", katakanahalf = "??" },
	de = { romaji = "de", hiragana = "?", katakana = "?", katakanahalf = "??" },
	d  = { romaji = "do", hiragana = "?", katakana = "?", katakanahalf = "??" },
	ba = { romaji = "ba", hiragana = "?", katakana = "?", katakanahalf = "??" },
	bi = { romaji = "bi", hiragana = "?", katakana = "?", katakanahalf = "??" },
	bu = { romaji = "bu", hiragana = "?", katakana = "?", katakanahalf = "??" },
	be = { romaji = "be", hiragana = "?", katakana = "?", katakanahalf = "??" },
	bo = { romaji = "bo", hiragana = "?", katakana = "?", katakanahalf = "??" },
	pa = { romaji = "pa", hiragana = "?", katakana = "?", katakanahalf = "??" },
	pi = { romaji = "pi", hiragana = "?", katakana = "?", katakanahalf = "??" },
	pu = { romaji = "pu", hiragana = "?", katakana = "?", katakanahalf = "??" },
	pe = { romaji = "pe", hiragana = "?", katakana = "?", katakanahalf = "??" },
	po = { romaji = "po", hiragana = "?", katakana = "?", katakanahalf = "??" },
	la = { romaji = "la",  hiragana = "?", katakana = "?", katakanahalf = "?" },
	li = { romaji = "li",  hiragana = "?", katakana = "?", katakanahalf = "?" },
	lu = { romaji = "lu",  hiragana = "?", katakana = "?", katakanahalf = "?" },
	le = { romaji = "le",  hiragana = "?", katakana = "?", katakanahalf = "?" },
	lo = { romaji = "lo",  hiragana = "?", katakana = "?", katakanahalf = "?" },
	ltu= { romaji = "ltu", hiragana = "?", katakana = "?", katakanahalf = "?" },
	lya= { romaji = "lya", hiragana = "?", katakana = "?", katakanahalf = "?" },
	lyo= { romaji = "lyo", hiragana = "?", katakana = "?", katakanahalf = "?" },
	line={ romaji = "-", hiragana = "?", katakana = "?", katakanahalf = "?"},
	curl={ romaji = "~", hiragana = "?", katakana = "?", katakanahalf = "~"}
}

local charlist2 = {
	a  = { romaji = "a",  hiragana = "?", katakana = "?", katakanahalf = "?" },
	i  = { romaji = "i",  hiragana = "?", katakana = "?", katakanahalf = "?" },
	u  = { romaji = "u",  hiragana = "?", katakana = "?", katakanahalf = "?" },
	e  = { romaji = "e",  hiragana = "?", katakana = "?", katakanahalf = "?" },
	o  = { romaji = "o",  hiragana = "?", katakana = "?", katakanahalf = "?" },
	n  = { romaji = "n",  hiragana = "?", katakana = "?", katakanahalf = "?" }
}

local function checkinput( fromtype, totype )
	if (fromtype == "all" or
		fromtype == "more" or
		fromtype == "standard" or
		fromtype == "romaji" or 
		fromtype == "hiragana" or 
		fromtype == "katakana" or 
		fromtype == "katakanahalf") and
		(totype == "romaji" or
		totype == "hiragana" or
		totype == "katakana" or
		totype == "katakanahalf") then
			return true
	end
	print("wrong input:", fromtype, totype)
	return false
end

local function converter_( s, fromtype, totype )
	for i,j in pairs(charlist) do
		for k=1, s:len() do
			local start, stop
			if j[fromtype] then
				start, stop = s:find(j[fromtype])
			end
			if start and stop then
				s = s:sub(1, start-1)..j[totype]..s:sub(stop+1)
			end
		end
	end
	return s
end

local function converter( s, fromtype, totype )
	for i,j in pairs(charlist1) do
		for k=1, s:len() do
			local start, stop
			if j[fromtype] then
				start, stop = s:find(j[fromtype])
			end
			if start and stop then
				s = s:sub(1, start-1)..j[totype]..s:sub(stop+1)
			end
		end
	end
	for i,j in pairs(charlist2) do
		for k=1, s:len() do
			local start, stop
			if j[fromtype] then
				start, stop = s:find(j[fromtype])
			end
			if start and stop then
				s = s:sub(1, start-1)..j[totype]..s:sub(stop+1)
			end
		end
	end
	return s
end

function j.conv( s, fromtype, totype )
	if checkinput( fromtype, totype ) then
		if fromtype == "all" then
			s = converter( s, "hiragana", totype )
			s = converter( s, "katakana", totype )
			s = converter( s, "katakanahalf", totype )
		elseif fromtype == "more" then
			s = converter( s, "hiragana", totype )
			s = converter( s, "katakana", totype )
			s = converter( s, "katakanahalf", totype )
			s = converter( s, "romaji", totype )
		elseif fromtype == "standard" then
			s = converter_( s, "hiragana", totype )
			s = converter_( s, "katakana", totype )
			s = converter_( s, "katakanahalf", totype )
			s = converter_( s, "hiraganasmall", totype )
			s = converter_( s, "katakanasmall", totype )
			s = converter_( s, "katakanahalfsmall", totype )
		else
			s = converter( s, fromtype, totype )
		end
	end
	return s
end
function j.test( s )
	local test = {}
	test.group = display.newGroup()
	for i=1, 26 do
		test[i] = display.newText( test.group, "", 0, i*28, nil, 25)
		test[i+26] = display.newText( test.group, "", 350, i*28, nil, 25)
	end
	test.group.x, test.group.y = 50, 50
	test.string = s

	test[1].text  = "original"

	test[2].text  = "romaji -> romaji"
	test[3].text  = "hiragana -> romaji"
	test[4].text  = "katakana -> romaji"
	test[5].text  = "katakanahalf -> romaji"
	test[6].text  = "all -> romaji"
	test[7].text  = "more -> romaji"

	test[8].text  = "romaji -> hiragana"
	test[9].text  = "hiragana -> hiragana"
	test[10].text = "katakana -> hiragana"
	test[11].text = "katakanahalf -> hiragana"
	test[12].text = "all -> hiragana"
	test[13].text = "more -> hiragana"

	test[14].text = "romaji -> katakana"
	test[15].text = "hiragana -> katakana"
	test[16].text = "katakana -> katakana"
	test[17].text = "katakanahalf -> katakana"
	test[18].text = "all -> katakana"
	test[19].text = "more -> katakana"

	test[20].text = "romaji -> katakanahalf"
	test[21].text = "hiragana -> katakanahalf"
	test[22].text = "katakana -> katakanahalf"
	test[23].text = "katakanahalf -> katakanahalf"
	test[24].text = "all -> katakanahalf"
	test[25].text = "more -> katakanahalf"

	test[26].text = "standard -> hiragana"
	test[1 +26].text = test.string
	test[2 +26].text = j.conv( test.string, "romaji", "romaji")
	test[3 +26].text = j.conv( test.string, "hiragana", "romaji")
	test[4 +26].text = j.conv( test.string, "katakana", "romaji")
	test[5 +26].text = j.conv( test.string, "katakanahalf", "romaji")
	test[6 +26].text = j.conv( test.string, "all", "romaji")
	test[7 +26].text = j.conv( test.string, "more", "romaji")

	test[8 +26].text = j.conv( test.string, "romaji", "hiragana")
	test[9 +26].text = j.conv( test.string, "hiragana", "hiragana")
	test[10+26].text = j.conv( test.string, "katakana", "hiragana")
	test[11+26].text = j.conv( test.string, "katakanahalf", "hiragana")
	test[12+26].text = j.conv( test.string, "all", "hiragana")
	test[13+26].text = j.conv( test.string, "more", "hiragana")

	test[14+26].text = j.conv( test.string, "romaji", "katakana")
	test[15+26].text = j.conv( test.string, "hiragana", "katakana")
	test[16+26].text = j.conv( test.string, "katakana", "katakana")
	test[17+26].text = j.conv( test.string, "katakanahalf", "katakana")
	test[18+26].text = j.conv( test.string, "all", "katakana")
	test[19+26].text = j.conv( test.string, "more", "katakana")

	test[20+26].text = j.conv( test.string, "romaji", "katakanahalf")
	test[21+26].text = j.conv( test.string, "hiragana", "katakanahalf")
	test[22+26].text = j.conv( test.string, "katakana", "katakanahalf")
	test[23+26].text = j.conv( test.string, "katakanahalf", "katakanahalf")
	test[24+26].text = j.conv( test.string, "all", "katakanahalf")
	test[25+26].text = j.conv( test.string, "more", "katakanahalf")

	test[26+26].text = j.conv( test.string, "standard", "hiragana")

	for i=1, 26 do
		test[i]:setReferencePoint( display.TopLeftReferencePoint )
		test[i].x = 0
		test[i+26]:setReferencePoint( display.TopLeftReferencePoint )
		test[i+26].x = 350
	end

	return test
end

return j


????j.conv( string, fromtype, totype )??????????????????
fromtype:

  • "romaji"

  • "hiragana"

  • "katakana"

  • "katakanahalf

  • "all" - ?????????????

  • "more" - "all"+"romaji"

  • "standard" - ?????????????????????


totype:

  • "romaji"

  • "hiragana"

  • "katakana"

  • "katakanahalf



j.test(string)?????????????????
????????????????????????????

?
local j = require "jconv" --??????"jconv.lua"????
local s = "???????"
print( j.conv(s,"all","romaji") ) --haro-wa-rudo
j.test(s)


????????????????????????"juu"?"???"???????"jilyuu"???
"fromtype"?"totype"?????????????????????????????????????????????

????????????????????
uid: 217596 topic_id: 36319 reply_id: 144378


[TOPIC: post.html]
#6

gtatarkin

[GLOBAL: userInfoPane.html]
gtatarkin
  • Contributor

  • 366 posts
  • Corona SDK

Are you from Japan? I badly need some help on Japan market form my friend. Could you write to me?
My email address is grzegorz.tatarkin(at)gmail.com

Best regards
uid: 12704 topic_id: 36319 reply_id: 144696



[topic_controls]
[/topic_controls]