2009-06-25 07:16:22 -07:00
|
|
|
|
/*
|
|
|
|
|
* VsqPhoneticSymbol.cs
|
|
|
|
|
* Copyright (c) 2008-2009 kbinani
|
|
|
|
|
*
|
|
|
|
|
* This file is part of Boare.Lib.Vsq.
|
|
|
|
|
*
|
|
|
|
|
* Boare.Lib.Vsq is free software; you can redistribute it and/or
|
|
|
|
|
* modify it under the terms of the BSD License.
|
|
|
|
|
*
|
|
|
|
|
* Boare.Lib.Vsq is distributed in the hope that it will be useful,
|
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|
|
|
|
*/
|
2010-03-16 20:14:08 -07:00
|
|
|
|
#if JAVA
|
|
|
|
|
package org.kbinani.vsq;
|
|
|
|
|
#else
|
2009-06-25 07:16:22 -07:00
|
|
|
|
using System;
|
2009-09-07 03:44:18 -07:00
|
|
|
|
using bocoree;
|
|
|
|
|
|
2009-06-25 07:16:22 -07:00
|
|
|
|
namespace Boare.Lib.Vsq {
|
2009-09-07 03:44:18 -07:00
|
|
|
|
using boolean = System.Boolean;
|
2010-03-16 20:14:08 -07:00
|
|
|
|
#endif
|
2009-09-07 03:44:18 -07:00
|
|
|
|
|
2009-06-25 07:16:22 -07:00
|
|
|
|
public class VsqPhoneticSymbol {
|
2009-09-07 03:44:18 -07:00
|
|
|
|
private static String[] _SYMBOL_VOWEL_JP = new String[]{
|
2010-03-16 20:14:08 -07:00
|
|
|
|
"a",
|
|
|
|
|
"i",
|
|
|
|
|
"M",
|
|
|
|
|
"e",
|
|
|
|
|
"o",
|
2009-06-25 07:16:22 -07:00
|
|
|
|
};
|
2009-09-07 03:44:18 -07:00
|
|
|
|
private static String[] _SYMBOL_CONSONANT_JP = new String[]{
|
2010-03-16 20:14:08 -07:00
|
|
|
|
"k",
|
|
|
|
|
"k'",
|
|
|
|
|
"g",
|
|
|
|
|
"g'",
|
|
|
|
|
"N",
|
|
|
|
|
"N'",
|
|
|
|
|
"s",
|
|
|
|
|
"S",
|
|
|
|
|
"z",
|
|
|
|
|
"Z",
|
|
|
|
|
"dz",
|
|
|
|
|
"dZ",
|
|
|
|
|
"t",
|
|
|
|
|
"t'",
|
|
|
|
|
"ts",
|
|
|
|
|
"tS",
|
|
|
|
|
"d",
|
|
|
|
|
"d'",
|
|
|
|
|
"n",
|
|
|
|
|
"J",
|
|
|
|
|
"h",
|
|
|
|
|
"h\\",
|
|
|
|
|
"C",
|
|
|
|
|
"p\\",
|
|
|
|
|
"p\\'",
|
|
|
|
|
"b",
|
|
|
|
|
"b'",
|
|
|
|
|
"p",
|
|
|
|
|
"p'",
|
|
|
|
|
"m",
|
|
|
|
|
"m'",
|
|
|
|
|
"j",
|
|
|
|
|
"4",
|
|
|
|
|
"4'",
|
|
|
|
|
"w",
|
|
|
|
|
"N\\",
|
2009-06-25 07:16:22 -07:00
|
|
|
|
};
|
2009-09-07 03:44:18 -07:00
|
|
|
|
private static String[] _SYMBOL_EN = new String[]{
|
2010-03-16 20:14:08 -07:00
|
|
|
|
"@",
|
|
|
|
|
"V",
|
|
|
|
|
"e",
|
|
|
|
|
"e",
|
|
|
|
|
"I",
|
|
|
|
|
"i:",
|
|
|
|
|
"{",
|
|
|
|
|
"O:",
|
|
|
|
|
"Q",
|
|
|
|
|
"U",
|
|
|
|
|
"u:",
|
|
|
|
|
"@r",
|
|
|
|
|
"eI",
|
|
|
|
|
"aI",
|
|
|
|
|
"OI",
|
|
|
|
|
"@U",
|
|
|
|
|
"aU",
|
|
|
|
|
"I@",
|
|
|
|
|
"e@",
|
|
|
|
|
"U@",
|
|
|
|
|
"O@",
|
|
|
|
|
"Q@",
|
|
|
|
|
"w",
|
|
|
|
|
"j",
|
|
|
|
|
"b",
|
|
|
|
|
"d",
|
|
|
|
|
"g",
|
|
|
|
|
"bh",
|
|
|
|
|
"dh",
|
|
|
|
|
"gh",
|
|
|
|
|
"dZ",
|
|
|
|
|
"v",
|
|
|
|
|
"D",
|
|
|
|
|
"z",
|
|
|
|
|
"Z",
|
|
|
|
|
"m",
|
|
|
|
|
"n",
|
|
|
|
|
"N",
|
|
|
|
|
"r",
|
|
|
|
|
"l",
|
|
|
|
|
"l0",
|
|
|
|
|
"p",
|
|
|
|
|
"t",
|
|
|
|
|
"k",
|
|
|
|
|
"ph",
|
|
|
|
|
"th",
|
|
|
|
|
"kh",
|
|
|
|
|
"tS",
|
|
|
|
|
"f",
|
|
|
|
|
"T",
|
|
|
|
|
"s",
|
|
|
|
|
"S",
|
|
|
|
|
"h",
|
2009-06-25 07:16:22 -07:00
|
|
|
|
};
|
|
|
|
|
|
2009-09-07 03:44:18 -07:00
|
|
|
|
public static boolean isConsonant( String symbol ) {
|
2010-03-16 20:14:08 -07:00
|
|
|
|
for ( int i = 0; i < _SYMBOL_CONSONANT_JP.Length; i++ ) {
|
2009-09-07 03:44:18 -07:00
|
|
|
|
String s = _SYMBOL_CONSONANT_JP[i];
|
|
|
|
|
if ( s.Equals( symbol ) ) {
|
2009-06-25 07:16:22 -07:00
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
2009-09-07 03:44:18 -07:00
|
|
|
|
public static boolean isValidSymbol( String symbol ) {
|
2010-03-16 20:14:08 -07:00
|
|
|
|
for ( int i = 0; i < _SYMBOL_VOWEL_JP.Length; i++ ) {
|
2009-09-07 03:44:18 -07:00
|
|
|
|
String s = _SYMBOL_VOWEL_JP[i];
|
|
|
|
|
if ( s.Equals( symbol ) ) {
|
2009-06-25 07:16:22 -07:00
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
}
|
2010-03-16 20:14:08 -07:00
|
|
|
|
for ( int i = 0; i < _SYMBOL_CONSONANT_JP.Length; i++ ) {
|
2009-09-07 03:44:18 -07:00
|
|
|
|
String s = _SYMBOL_CONSONANT_JP[i];
|
|
|
|
|
if ( s.Equals( symbol ) ) {
|
2009-06-25 07:16:22 -07:00
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
}
|
2010-03-16 20:14:08 -07:00
|
|
|
|
for ( int i = 0; i < _SYMBOL_EN.Length; i++ ) {
|
2009-09-07 03:44:18 -07:00
|
|
|
|
String s = _SYMBOL_EN[i];
|
|
|
|
|
if ( s.Equals( symbol ) ) {
|
2009-06-25 07:16:22 -07:00
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2010-03-16 20:14:08 -07:00
|
|
|
|
#if !JAVA
|
2009-06-25 07:16:22 -07:00
|
|
|
|
}
|
2010-03-16 20:14:08 -07:00
|
|
|
|
#endif
|