lipsync/trunk/Boare.Lib.Vsq/VsqPhoneticSymbol.cs
kbinani 9de5d2e51e [trunk] (ry
git-svn-id: http://svn.sourceforge.jp/svnroot/lipsync@18 b1f601f4-4f45-0410-8980-aecacb008692
2010-03-17 03:14:08 +00:00

162 lines
3.7 KiB
C#

/*
* 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.
*/
#if JAVA
package org.kbinani.vsq;
#else
using System;
using bocoree;
namespace Boare.Lib.Vsq {
using boolean = System.Boolean;
#endif
public class VsqPhoneticSymbol {
private static String[] _SYMBOL_VOWEL_JP = new String[]{
"a",
"i",
"M",
"e",
"o",
};
private static String[] _SYMBOL_CONSONANT_JP = new String[]{
"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\\",
};
private static String[] _SYMBOL_EN = new String[]{
"@",
"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",
};
public static boolean isConsonant( String symbol ) {
for ( int i = 0; i < _SYMBOL_CONSONANT_JP.Length; i++ ) {
String s = _SYMBOL_CONSONANT_JP[i];
if ( s.Equals( symbol ) ) {
return true;
}
}
return false;
}
public static boolean isValidSymbol( String symbol ) {
for ( int i = 0; i < _SYMBOL_VOWEL_JP.Length; i++ ) {
String s = _SYMBOL_VOWEL_JP[i];
if ( s.Equals( symbol ) ) {
return true;
}
}
for ( int i = 0; i < _SYMBOL_CONSONANT_JP.Length; i++ ) {
String s = _SYMBOL_CONSONANT_JP[i];
if ( s.Equals( symbol ) ) {
return true;
}
}
for ( int i = 0; i < _SYMBOL_EN.Length; i++ ) {
String s = _SYMBOL_EN[i];
if ( s.Equals( symbol ) ) {
return true;
}
}
return false;
}
}
#if !JAVA
}
#endif