public static char GetVowel(Vowel vowel, Tone tone) { var v = (int)Convert.ChangeType(vowel, vowel.GetTypeCode()); var t = (int)Convert.ChangeType(tone, tone.GetTypeCode()); return(characters[v - 1][t - 1]); }
public void TestIfContainsVowel() { var vowel = "abcdef"; var v = new Vowel(vowel); Assert.IsTrue(v.ContainsVowel()); }
public void TestIfIsSetOfVowel() { var vowel = "uoia"; var v = new Vowel(vowel); Assert.IsTrue(v.IsSetOfVowels()); }
public void TestIfIsSetOfVowelIsInvalid() { var vowel = "abcdf"; var con = new Vowel(vowel); Assert.IsFalse(con.IsSetOfVowels()); }
void InvokeCallback() { if (onLipSyncUpdate == null) { return; } var vowelInfo = config.checkThirdFormant ? LipSyncUtil.GetVowel(jobResult_[0].f1, jobResult_[0].f2, jobResult_[0].f3, profile) : LipSyncUtil.GetVowel(new FormantPair(jobResult_[0].f1, jobResult_[0].f2), profile); float volume = jobResult_[0].volume; FormantPair formant = vowelInfo.formant; Vowel vowel = vowelInfo.vowel; if (config.checkSecondDerivative) { var vowelInfoBySecondDerivative = config.checkThirdFormant ? LipSyncUtil.GetVowel(jobResult_[1].f1, jobResult_[1].f2, jobResult_[1].f3, profile) : LipSyncUtil.GetVowel(new FormantPair(jobResult_[1].f1, jobResult_[1].f2), profile); if (vowelInfo.diff > vowelInfoBySecondDerivative.diff) { formant = vowelInfoBySecondDerivative.formant; vowel = vowelInfoBySecondDerivative.vowel; } } UpdateLipSyncInfo(volume, formant, vowel); onLipSyncUpdate.Invoke(result); }
public void TestIfIsVowel() { var vowel = "a"; var v = new Vowel(vowel); Assert.IsTrue(v.IsVowel()); }
private GameObject GetCharacter(CharType charType, Vowel vowel) { //List that will contain types of the selected character List <GameObject> selected = new List <GameObject>(); //Transfer list of types to selected for (int i = 0; i < charTypeArray.Length; i++) { if (charType == charTypeArray[i]) { selected = characters[i]; break; } } //Return character with the specified vowel for (int i = 0; i < vowelArray.Length; i++) { if (vowel == vowelArray[i]) { return(selected[i]); } } return(null); }
static void Main(string[] args) { Console.Write("Enter a character: "); String s = Console.ReadLine(); if (s.Length > 0) { char c = s[0]; if (Vowel.IsVowel(c)) { Console.WriteLine(c + " is a vowel"); } else { Console.WriteLine(c + " is a NOT vowel"); } } else { Console.WriteLine("nothing is entered"); } //Select this exercise as the startup project //press CTRL-F5 to run the program }
public void BackSpace() { RectTransform[] children = inputOrigin.GetComponentsInChildren <RectTransform>(); GameObject lastEntry = GetLastElement(charEntries); CharType lastConsonant = GetLastElement(charEntries).GetComponent <CharEntry>().charType; Vowel lastVowel = GetLastElement(charEntries).GetComponent <CharEntry>().vowel; if ((lastConsonant != CharType.NG) && (lastVowel == Vowel.none)) { textValue = textValue.Remove(textValue.Length - 1); } else if ((lastConsonant == CharType.NG) && (lastVowel != Vowel.none)) { textValue = textValue.Remove(textValue.Length - 3); } else { textValue = textValue.Remove(textValue.Length - 2); } inputOrigin.transform.position = permpos; charEntries.Remove(lastEntry); Destroy(lastEntry); RemovePreviousCharacter(); newTextPosition -= padding; HandleButtons(); }
void UpdateLipSyncInfo(float volume, FormantPair formant, Vowel vowel) { float sf = 1f - openSmoothness; float sb = 1f - closeSmoothness; float preVolume = result.volume; rawResult_.volume = volume; float normalizedVolume = Mathf.Clamp((volume - minVolume) / (maxVolume - minVolume), 0f, 1f); float smooth = normalizedVolume > preVolume ? sf : sb; result.volume += (normalizedVolume - preVolume) * smooth; rawResult_.formant = result.formant = formant; if (volume < minVolume) { return; } if (vowel == Vowel.None) { return; } float max = 0f; float sum = 0f; for (int i = (int)Vowel.A; i <= (int)Vowel.None; ++i) { var key = (Vowel)i; float target = key == vowel ? 1f : 0f; float value = rawResult_.vowels[key]; value += (target - value) * (1f - vowelTransitionSmoothness); if (value > max) { rawResult_.mainVowel = key; max = value; } rawResult_.vowels[key] = value; sum += value; } result.mainVowel = rawResult_.mainVowel; for (int i = (int)Vowel.A; i <= (int)Vowel.None; ++i) { var key = (Vowel)i; if (sum > Mathf.Epsilon) { result.vowels[key] = rawResult_.vowels[key] / sum; } else { result.vowels[key] = 0f; } } }
void DrawBlendShape(Vowel vowel, BlendShapeInfo info) { EditorGUILayout.BeginHorizontal(); EditorGUILayout.PrefixLabel(vowel.ToString()); DrawBlendShapePopup(info); DrawFactor(info); EditorGUILayout.EndHorizontal(); }
static float scoreOfLanguage(List<Formant[]> observations, Vowel[] language) { float score = 0; foreach (var observation in observations) { score += Math.Max(0, language.Min(v => { float formant1Middle = (v.formantHighs[0] + v.formantLows[0]) / 2; float formant2Middle = (v.formantHighs[1] + v.formantLows[1]) / 2; float formant3Middle = (v.formantHighs[2] + v.formantLows[2]) / 2; return Math.Abs(observation[0].freq - formant1Middle) + Math.Abs(observation[1].freq - formant2Middle) + Math.Abs(observation[2].freq - formant3Middle); })); } return score / observations.Count; }
public Diacritic(Vowel phone, int diacriticImpact = 0) { this.Stress = phone.Stress; this.Context = phone.Context; this.Example = phone.Example; this.Length = phone.Length; this.Nasality = phone.Nasality; this.Phonation = phone.Phonation; this.Speaker = phone.Speaker; this.Symbol = phone.Symbol; this.DiacriticImpact = diacriticImpact; }
public override BaseCollection <TextParticle> Short(int maxLength) { var clone = new WordCollection(this.Default); var cuttingLength = default(int?); if (clone.Edited.Length > maxLength) { // remove os conectivos. for (var index = clone.Count - 1; index >= 0 && clone.Edited.Length > maxLength; index--) { var item = clone.ElementAt(index); if (ConnectivesNames.Contains(item.DefaultNormalize) || item.DefaultNormalize.Length == 1 && Vowel.Contains(item.DefaultNormalize[0])) { item.Visible = false; } } var middle = clone.Count / 2; var before = middle - 1; var after = middle + 1; if (middle >= 0) { clone.ElementAt(middle).Edited = this.Cutting(clone.ElementAt(middle).Edited, cuttingLength); } while (clone.Edited.Length > maxLength && (before >= 0 || after < clone.Count)) { if (before >= 0) { clone.ElementAt(before).Edited = this.Cutting(clone.ElementAt(before--).Edited, cuttingLength); } if (clone.Edited.Length > maxLength && after < clone.Count) { clone.ElementAt(after).Edited = this.Cutting(clone.ElementAt(after++).Edited, cuttingLength); } } if (clone.Edited.Length > maxLength) { return(null); } } return(clone); }
public void Callibration(AudioClip clip, Vowel vowel) { int samples = clip.samples; float df = (float)clip.frequency / sampleNum; var rawData = new float[samples * clip.channels]; clip.GetData(rawData, 0); float f1 = 0.0f; float f2 = 0.0f; int num = 0; for (int i = 0; i < samples / sampleNum; ++i) { if (sampleNum * (i + 1) >= samples) { break; } var input = new float[sampleNum]; System.Array.Copy(rawData, sampleNum * i, input, 0, sampleNum); if (GetVolume(input) > minVolume) { var formantIndices = GetFormantIndices(input); f1 += formantIndices.x * df; f2 += formantIndices.y * df; ++num; } } f1 /= num; f2 /= num; switch (vowel) { case Vowel.A: aCenterF1 = f1; aCenterF2 = f2; break; case Vowel.I: iCenterF1 = f1; iCenterF2 = f2; break; case Vowel.U: uCenterF1 = f1; uCenterF2 = f2; break; case Vowel.E: eCenterF1 = f1; eCenterF2 = f2; break; case Vowel.O: oCenterF1 = f1; oCenterF2 = f2; break; } }
public void TypeBaybayin(CharType charType, Vowel vowel) { if (charEntries.Count >= characterLimit) { return; } if (charType != CharType.NoConsonant) { if (!IsCharacterUnlocked(charType)) { return; } } //adjust existing character inputs to fit next AddCharacterAdjustment(); //instantiate new character input GameObject characterToInput = Instantiate(GetCharacter(charType, vowel)); characterToInput.transform.SetParent(inputOrigin.transform); characterToInput.transform.position = new Vector3 ( inputOrigin.transform.position.x + newTextPosition, inputOrigin.transform.position.y, inputOrigin.transform.position.z ); InitCharEntry(characterToInput, charType, vowel); charEntries.Add(characterToInput); //keep characters centered inputOrigin.transform.position = permpos; // set new position of typing cursor newTextPosition += padding; updateValue(); HandleButtons(); }
// modifies the vowel in the character public void ModifyBaybayin(Vowel vowel) { GameObject lastElement = GetLastElement(charEntries); CharType charType = lastElement.GetComponent <CharEntry>().charType; if (charType == CharType.NoConsonant) { return; } GameObject characterToInput = Instantiate(GetCharacter(charType, vowel)); characterToInput.transform.SetParent(inputOrigin.transform); characterToInput.transform.position = lastElement.transform.position; InitCharEntry(characterToInput, charType, vowel); charEntries.Remove(lastElement); Destroy(lastElement); charEntries.Add(characterToInput); updateValue(); }
/// <summary> /// <see cref="Hangul"/> 구조체의 인스턴스를 초기화합니다. /// </summary> /// <param name="character"><see cref="Hangul"/> 구조체로 변환될 한글 문자입니다.</param> public Hangul(char character) { if (CheckHangulSyllable(character)) { int unicodeValue = character; unicodeValue -= 0xac00; var remainder = unicodeValue % (VowelCount * FinalConsonantCount); Consonant = (Consonant)(unicodeValue / (VowelCount * FinalConsonantCount)); Vowel = (Vowel)(remainder / FinalConsonantCount); FinalConsonant = (FinalConsonant)(remainder % FinalConsonantCount); } else { Consonant = Consonant.Failed; Vowel = Vowel.Failed; FinalConsonant = FinalConsonant.Failed; } }
/// <summary> /// 이중모음을 단모음으로 바꿉니다. /// </summary> /// <param name="vowel">단모음으로 변환할 모음입니다.</param> /// <returns>단모음입니다.</returns> /// <remarks> /// <para>특수 규칙인 (ㅟ, ㅢ) → ㅣ, (ㅚ) → ㅔ 는 필요시 호출자측에서 적절한 분기를 통해 다른 규칙을 적용하시는 것이 좋습니다. 특히 'ㅢ'의 경우에는 'ㅔ'로 발음되는 경우도 있으나 음이 늘어질경우 'ㅣ'로 변화하는 특성이 강해 'ㅣ'로 변경하도록 하였습니다.</para> /// </remarks> public static Vowel MakeShortVowel(Vowel vowel) { // 자체 연구한 규칙으로 구현됨 switch (vowel) { case Vowel.ㅑ: case Vowel.ㅒ: case Vowel.ㅕ: case Vowel.ㅖ: vowel -= 2; break; case Vowel.ㅛ: case Vowel.ㅠ: vowel -= 4; break; case Vowel.ㅘ: case Vowel.ㅙ: vowel -= 9; break; case Vowel.ㅝ: case Vowel.ㅞ: vowel -= 10; break; // 아래는 특수 규칙 case Vowel.ㅟ: case Vowel.ㅢ: vowel = Vowel.ㅣ; break; case Vowel.ㅚ: vowel = Vowel.ㅔ; break; } return(vowel); }
public void Init(CharType charType, Vowel vowel) { this.charType = charType; this.vowel = vowel; }
private void InitCharEntry(GameObject entry, CharType charType, Vowel vowel) { entry.AddComponent <CharEntry>(); entry.GetComponent <CharEntry>().Init(charType, vowel); }
bool TryMatchConsonantVowel(List<LetterSoundComponent> pattern, int idxOfFirstLetter) { LetterSoundComponent beforeVowel = pattern [0]; if (beforeVowel.IsConsonantConsonantDigraphOrBlend) { LetterSoundComponent last = pattern [1]; if (last.IsVowelOrVowelDigraph) { //Oct 2: Min wants open syllable patterns (consonant-vowel) to read as short. if (last is Vowel) { Vowel v = (Vowel)last; v.MakeShort (); } return true; } if (last.LettersAre ("y")) { preSyllable [idxOfFirstLetter + 1] = new Vowel ("y"); return true; } } return false; }
public void Constructor_WrongSymbol_Exception(char input) { var letter = new Vowel(input); }
public void Callibration(AudioClip clip, Vowel vowel) { int samples = clip.samples; float df = (float)clip.frequency / sampleNum; var rawData = new float[samples * clip.channels]; clip.GetData(rawData, 0); float f1 = 0.0f; float f2 = 0.0f; int num = 0; for (int i = 0; i < samples / sampleNum; ++i) { if (sampleNum * (i + 1) >= samples) break; var input = new float[sampleNum]; System.Array.Copy(rawData, sampleNum * i, input, 0, sampleNum); if ( GetVolume(input) > minVolume) { var formantIndices = GetFormantIndices(input); f1 += formantIndices.x * df; f2 += formantIndices.y * df; ++num; } } f1 /= num; f2 /= num; switch (vowel) { case Vowel.A : aCenterF1 = f1; aCenterF2 = f2; break; case Vowel.I : iCenterF1 = f1; iCenterF2 = f2; break; case Vowel.U : uCenterF1 = f1; uCenterF2 = f2; break; case Vowel.E : eCenterF1 = f1; eCenterF2 = f2; break; case Vowel.O : oCenterF1 = f1; oCenterF2 = f2; break; } }
// NAME :- MAIN METHOD // AUTHOR NAME :- SHIKHA MALIK // DECRIPTION :- MAIN METHOD // CREATED DATE :- 16/07/2012 static void Main(string[] args) { string strS; Vowel objVowel; SwitchVowel objSvowel; CaseCheck objCaseCheck; Reverse objReverse; PowerNum objPowerNum; WindowName objWindowName; //Declaration of variable char chr = 'a'; int n, m; ArrayList arrLstN = new ArrayList(); List <object> arrLstlist = new List <object>(); StructDate[] objdt; ReverseSort objReverse1; SearchArray objSearchArray; ReviseArray objReviseArray; CopyArray objCopyArray; NotePadApplication objNotePadApplication; Franchisee objFranchisee; Customer objCustomer; BubbleSort objBubbleSort; TransformArry objTransformArry; CastValue objCastValue; StringBldr objStringBldr; StructDate objStructure; DateArray objDateArray; TextFile objTextFile; ReadTextFile objReadTextFile; ArrayList arrLstCarArmd = new ArrayList(); List <object> objListCar5 = new List <object>(); Driver objDriver; Car objCar; Car2 objCar2; Car3 objCar3; Car4 objCar4; ArmoredVehicle objArmoredVehicle; CarArmoredVcle objCarArmoredVcle; CarArmoredVcle1 objCarArmoredVcle1; Car5 objCar5; List <object> objArryLstD = new List <object>(); List <object> objArryLstD1 = new List <object>(); try { System.Console.WriteLine(Constant.strEntrP1); System.Console.WriteLine(Constant.strEntrP2); System.Console.WriteLine(Constant.strEntrP3); System.Console.WriteLine(Constant.strEntrP4); System.Console.WriteLine(Constant.strEntrP5); System.Console.WriteLine(Constant.strEntrP6); System.Console.WriteLine(Constant.strEntrP7); System.Console.WriteLine(Constant.strEntrP8); System.Console.WriteLine(Constant.strEntrP9); System.Console.WriteLine(Constant.strEntrP10); System.Console.WriteLine(Constant.strEntrP11); System.Console.WriteLine(Constant.strEntrP12); System.Console.WriteLine(Constant.strEntrP13); System.Console.WriteLine(Constant.strEntrP14); System.Console.WriteLine(Constant.strEntrP15); System.Console.WriteLine(Constant.strEntrP16); System.Console.WriteLine(Constant.strEntrP17); System.Console.WriteLine(Constant.strEntrP18); System.Console.WriteLine(Constant.strEntrP19); System.Console.WriteLine(Constant.strEntrP20); System.Console.WriteLine(Constant.strEntrP21); System.Console.WriteLine(Constant.strEntrP22); System.Console.WriteLine(Constant.strEntrP23); System.Console.WriteLine(Constant.strEntrP24); System.Console.WriteLine(Constant.strEntrP25); System.Console.WriteLine(Constant.strEntrP26); System.Console.WriteLine(Constant.strEntrP27); System.Console.WriteLine(Constant.strEntrP28); System.Console.WriteLine(Constant.strEntrP29); System.Console.WriteLine(Constant.strEntrP30); System.Console.WriteLine(Constant.strEntrP31); System.Console.WriteLine(Constant.strEntrP32); System.Console.WriteLine(Constant.strEntrP33); System.Console.WriteLine(Constant.strEntrP34); System.Console.WriteLine(Constant.strEntrP35); System.Console.WriteLine(Constant.strSpace); System.Console.WriteLine(Constant.strStar); do { System.Console.WriteLine(Constant.strEntrCh); //Gather Information regarding choice strS = System.Console.ReadLine(); //Read value of string switch (strS) { case "2.1": //case use for 2.1 exercise that is chracter is vowel or not objVowel = new Vowel(); //create object for class objVowel.vowelc(); break; case "2.2": //case use for 2.2 exercise that is chracter is vowel or not using swith case objSvowel = new SwitchVowel(); //create object for class objSvowel.Switchvl(); break; case "2.3": //case use for 2.3 exercise that is for Enter digit , char in both case and count their times. objCaseCheck = new CaseCheck(); //create object for class objCaseCheck.CaseC(); break; case "2.4": //case use for 2.4 exercise that is use for reverse array objReverse = new Reverse(); //create object for class objReverse.Rev(); break; case "2.5": // case use for 2.5 exercise that is use for reverse array and sort array objReverse1 = new ReverseSort(); //create object for class objReverse1.RevS(); break; case "2.6": // case use for 2.6 exercise that is use for search element from arry objSearchArray = new SearchArray(); //create object for class objSearchArray.Sarray(); break; case "2.7": // case use for 2.7 exercise that is use for serch element and print number of times its exists. objReviseArray = new ReviseArray(); //create object for class objReviseArray.Rarray(); break; case "2.8": // case use for 2.8 exercise that is use for copy array according to condition objCopyArray = new CopyArray(); //create object for class objCopyArray.Carray(); break; case "2.9": // case use for 2.9 exercise that is use for calculate the power of entered number objPowerNum = new PowerNum(); //create object for class objPowerNum.Pwrnum(); break; case "2.10": // case use for 2.10 exercise that is used for open notepad objNotePadApplication = new NotePadApplication(); //create object for class objNotePadApplication.Notepad(); break; case "2.11": // case use for 2.11 exercise that is used for display required system information objWindowName = new WindowName(); //create object for class objWindowName.WinName(); break; case "4.7": // case use for 4.7 exercise that is for arraylist Console.WriteLine(Constant.strEnumObjArry); //message for enter number of object of Customer class n = int.Parse(Console.ReadLine()); for (int i = 1; i <= n; i++) // loop for number of times of object of Customer class { objCustomer = new Customer(); Console.WriteLine(Constant.strEntrsalCt + "" + i); objCustomer.Salutation = Console.ReadLine(); Console.WriteLine(Constant.strEntrNmCt + "" + i); objCustomer.Name = Console.ReadLine(); Console.WriteLine(Constant.strEntrMatCt + "" + i); objCustomer.Maritial_Status = Console.ReadLine(); Console.WriteLine(Constant.strEntrGenCt + "" + i); objCustomer.Gender = Console.ReadLine(); Console.WriteLine(Constant.strEntrAddCt + "" + i); objCustomer.Address = Console.ReadLine(); Console.WriteLine(Constant.strEntrQualCt + "" + i); objCustomer.Qualification = Console.ReadLine(); Console.WriteLine(Constant.strEntrLanCt + "" + i); objCustomer.Language = Console.ReadLine(); arrLstN.Add(objCustomer); //add into arraylist } Console.WriteLine(Constant.strEntrObjFrch); // message for enter number of object of Franchisee class m = int.Parse(Console.ReadLine()); for (int i = 1; i <= m; i++) // loop for number of times of object of Franchisee class { objFranchisee = new Franchisee(); Console.WriteLine(Constant.strEntrFeesFrch + "" + i); objFranchisee.Fees = int.Parse(Console.ReadLine()); arrLstN.Add(objFranchisee); //add into arraylist } Console.ReadLine(); break; case "4.8": // case use for 4.8 exercise that is for show arraylist for (int i = 0; i < arrLstN.Count; i++) { Console.WriteLine(arrLstN[i].ToString()); } break; case "4.9": // case use for 4.9 exercise that is for Typed Arraylist Console.WriteLine(Constant.strEnumObjList); //message for enter number of object of Customer class n = int.Parse(Console.ReadLine()); for (int i = 1; i <= n; i++) // loop for number of times of object of Customer class { objCustomer = new Customer(); Console.WriteLine(Constant.strEntrsalCt + "" + i); objCustomer.Salutation = Console.ReadLine(); Console.WriteLine(Constant.strEntrNmCt + "" + i); objCustomer.Name = Console.ReadLine(); Console.WriteLine(Constant.strEntrMatCt + "" + i); objCustomer.Maritial_Status = Console.ReadLine(); Console.WriteLine(Constant.strEntrGenCt + "" + i); objCustomer.Gender = Console.ReadLine(); Console.WriteLine(Constant.strEntrAddCt + "" + i); objCustomer.Address = Console.ReadLine(); Console.WriteLine(Constant.strEntrQualCt + "" + i); objCustomer.Qualification = Console.ReadLine(); Console.WriteLine(Constant.strEntrLanCt + "" + i); objCustomer.Language = Console.ReadLine(); arrLstlist.Add(objCustomer); // add into List } Console.WriteLine(Constant.strEntrObjFrch); m = int.Parse(Console.ReadLine()); for (int i = 1; i <= m; i++) { objFranchisee = new Franchisee(); Console.WriteLine(Constant.strEntrFeesFrch + "" + i); objFranchisee.Fees = int.Parse(Console.ReadLine()); arrLstlist.Add(objFranchisee); // add into List } Console.ReadLine(); break; case "4.10": // case use for 4.10 exercise that is for show arraylist for (int i = 0; i < arrLstlist.Count; i++) { Console.WriteLine(arrLstlist[i].ToString()); } break; case "4.11": //case use for 4.11 exercise that is use for sorting array objBubbleSort = new BubbleSort(); //create object for class objBubbleSort.BublSrt(); break; case "4.12": //case use for 4.12 exercise that is used for transform matrix objTransformArry = new TransformArry(); //create object for class objTransformArry.TrnsfrmArr(); break; case "4.13": //case use for 4.13 exercise that is used for casting of double value objCastValue = new CastValue(); objCastValue.CastFltMy(); //create object for class break; case "4.14": //case use for 4.14 exercise that is used for convert input amount into string objStringBldr = new StringBldr(); Console.WriteLine(Constant.strEntrAmount); int intN = int.Parse(Console.ReadLine()); string strS2; strS2 = objStringBldr.NumToWrds(intN); //create object for class Console.WriteLine(strS2); break; case "4.15": //case use for 4.15 exercise that is used for create StructDate objStructure = new StructDate(); objStructure.dateArray(); // //create object for class break; case "4.16": //Case use for 4.16 exercise that is used for sorting date Console.WriteLine(Constant.strEnumDate); int size = Convert.ToInt32(Console.ReadLine()); objdt = new StructDate[size]; //create object of structDate array for (int i = 0; i < size; i++) { Console.WriteLine(Constant.strEntrdate + (i + 1)); Console.WriteLine(objdt[i].dateArray()); } objDateArray = new DateArray(); objDateArray.dateArray(objdt); //Pass by value objDateArray.dateArray(ref objdt); //Pass by Reference break break; case "4.17": //Case use for 4.17 exercise that is used for Write lines on file objTextFile = new TextFile(); //create object for class objTextFile.TextFileM(); break; case "4.18": //Case use for 4.18 exercise that is used for read file content objReadTextFile = new ReadTextFile(); //create object for class objReadTextFile.ReadText(); break; case "7.1": //Case use for 7.1 exercise that is used Driver class objDriver = new Driver(); objDriver.Drive(); //create object for class break; case "7.2": objCar = new Car(); //Case use for 7.2 exercise that is used Car class objCar.Drive(); break; case "7.3": //Case use for 7.3 exercise that is used Car2 class objCar2 = new Car2(); objCar2.Drive(); //create object for class break; case "7.4": //Case use for 7.4 exercise that is used Car3 class objCar3 = new Car3(); objCar3.Drive(); //create object for class break; case "7.5": //Case use for 7.5 exercise that is used Car4 class objCar4 = new Car4(); objCar4.Destruct(); //create object for class break; case "7.6": //Case use for 7.6 exercise that is used ArmoredVehicle class objArmoredVehicle = new ArmoredVehicle(); objArmoredVehicle.Destruct(); //create object for class break; case "7.7": //Case use for 7.7 exercise that is used CarArmoredVcle class objCarArmoredVcle = new CarArmoredVcle(); ArrayList objarr = objCarArmoredVcle.CarArmored(); //create object for class foreach (object obj in objarr) { Console.WriteLine(obj); } break; case "7.8": //Case use for 7.8 exercise that is used CCarArmoredVcle1 class objCarArmoredVcle1 = new CarArmoredVcle1(); ArrayList objarr1 = objCarArmoredVcle1.CarArmored(); //create object for class foreach (object obj in objarr1) { try { Console.WriteLine(obj); } catch (VehicleNtDestydException v) { Console.WriteLine(v.Message); } } break; case "7.9": //Case use for 7.9 exercise that is used Arraylist, create dynamically object Console.WriteLine(Constant.strEntrCarobject); int intLst1 = int.Parse(Console.ReadLine()); for (int i = 0; i < intLst1; i++) //Create object in looping { Console.WriteLine(Constant.strEntrCarModel); string strModelnm = Console.ReadLine(); objCar5 = new Car5(strModelnm); objArryLstD1.Add(objCar5); //Add object intito Arraylist } for (int i = 0; i < objArryLstD1.Count; i++) //looping for traverse list { Console.WriteLine(objArryLstD1[i].ToString()); } break; //objListCar5.Add(objCar5 = new Car5("IV-Tec")); //objListCar5.Add(objCar5 = new Car5("City Honda")); //foreach (object obj in objListCar5) //{ // Console.WriteLine(obj.ToString()); //} // break; case "7.10": //Case use for 7.10 exercise that is used Arraylist, create dynamically object and make readonly property Console.WriteLine(Constant.strEntrCarobject); int intLst = int.Parse(Console.ReadLine()); for (int i = 0; i < intLst; i++) //Create object in looping { Console.WriteLine(Constant.strEntrCarModel); string strModelnm = Console.ReadLine(); CarArmoredVclList objCarArmoredVclList = new CarArmoredVclList(strModelnm); objArryLstD.Add(objCarArmoredVclList); //Add object intito Arraylist } for (int i = 0; i < objArryLstD.Count; i++) //looping for traverse list { Console.WriteLine(objArryLstD[i].ToString()); } break; case "7.11": //Case use for 7.11 exercise that is used for fuel calculation Console.WriteLine(Constant.strIniValCar); //Enter initial value for car int intK = Convert.ToInt16(Console.ReadLine()); Car6 objCar6 = new Car6(intK); Console.WriteLine(Constant.strIniValArmored); //Enter initial value for Armored Vehicle int intC = Convert.ToInt16(Console.ReadLine()); CarFuelCmsptn objCarFuelCmsptn = new CarFuelCmsptn(intC); objCarFuelCmsptn.FuelEfficiency = 5; objCar6.FuelEfficiency = 14; Console.WriteLine(Constant.strEntrKiloCar); //Enter number of Kilometer Driven by Car by user try { objCar6.Drive(Convert.ToDouble(Console.ReadLine())); } catch (NoFuelLeftException v) { Console.WriteLine(v); } Console.WriteLine(Constant.strEntrKiloArmored); // Enter number of Kilometer Driven by ArmoredVehicle by user try { objCar6.Drive(Convert.ToDouble(Console.ReadLine())); } catch (NoFuelLeftException StrFuel) { Console.WriteLine(StrFuel); } break; case "7.12": //Case use for 7.11 exercise that is used for create hash table, add object in it. HashTblCar objHashTblCar = new HashTblCar(); objHashTblCar.HashTblSort(); //create object for class break; default: Console.WriteLine(Constant.strEntrNch); //enter no choice break; } Console.WriteLine(Constant.strEntrCyn); // Gather information that you want continue or not chr = Char.Parse(Console.ReadLine()); // Read value of character } while (chr == 'Y' || chr == 'y'); if (chr == 'N' || chr == 'n') { Console.WriteLine(Constant.strMsg); // Display message if you press N Console.ReadLine(); } } catch (Exception ex) { System.Console.WriteLine(ex.Message.ToString()); // throw exception Console.Read(); } finally { strS = null; objVowel = null; objSvowel = null; objCaseCheck = null; //REALLOCATE THE MEMORY objdt = null; objReverse = null; objPowerNum = null; objWindowName = null; objReverse1 = null; objSearchArray = null; objReviseArray = null; objCopyArray = null; objNotePadApplication = null; objDateArray = null; objTextFile = null; objReadTextFile = null; objDriver = null; objCar = null; objCar2 = null; objCar3 = null; objCar4 = null; objCar5 = null; objArmoredVehicle = null; objCarArmoredVcle = null; objCarArmoredVcle1 = null; } }
/// <summary> /// <see cref="Hangul"/> 구조체의 인스턴스를 초기화합니다. /// </summary> /// <param name="consonant">설정할 자음입니다.</param> /// <param name="vowel">설정할 모음입니다.</param> /// <param name="finalConsonant">설정할 받침입니다. 기본값은 <see cref="FinalConsonant.None"/>입니다.</param> public Hangul(Consonant consonant, Vowel vowel, FinalConsonant finalConsonant = FinalConsonant.None) { this.Consonant = consonant; this.Vowel = vowel; this.FinalConsonant = finalConsonant; }
void DrawVowelRegion(Graphics graphics, Font font, Vowel v) { float f1Scale = Width / 1400f; float f2Scale = Height / 3500f; float lowF1 = v.formantLows[0] * f1Scale; float highF1 = v.formantHighs[0] * f1Scale; float lowF2 = (v.formantLows[1] - 500) * f2Scale; float highF2 = (v.formantHighs[1] - 500) * f2Scale; float stdDevF1 = v.formantStdDevs[0] * f1Scale; float stdDevF2 = v.formantStdDevs[1] * f2Scale; Brush b = (v.vowel == targetVowel) ? Brushes.Black : Brushes.Gray; Pen p = (v.vowel == targetVowel) ? Pens.White : Pens.Gray; var vowelBoundaryPoints = new PointF[] { new PointF(lowF1 - stdDevF1, Height - (lowF2 + stdDevF2)), new PointF(lowF1 - stdDevF1, Height - (lowF2 - stdDevF2)), new PointF(lowF1 + stdDevF1, Height - (lowF2 - stdDevF2)), new PointF(highF1 + stdDevF1, Height - (highF2 - stdDevF2)), new PointF(highF1 + stdDevF1, Height - (highF2 + stdDevF2)), new PointF(highF1 - stdDevF1, Height - (highF2 + stdDevF2)), }; // Amplitude values here are in decibels (all negative). Roundedness will range -0db to -50db, here 0 to 1. double roundedness = Roundedness(v.formantAmplitudes[0], v.formantAmplitudes[1], v.formantAmplitudes[2]); graphics.FillPolygon(new SolidBrush(HsvToColor(roundedness * 180, 0.6, 1.0, 255)), vowelBoundaryPoints); graphics.DrawPolygon(p, vowelBoundaryPoints); graphics.DrawString(v.vowel, font, b, (lowF1 + highF1) / 2f - 7, Height - (lowF2 + highF2) / 2f - 7); }
public void MakeShortVowel() { for (int i = 0; i < Hangul.VowelCount; i++) { Vowel vowel = (Vowel)i; Vowel shortVowel = Hangul.MakeShortVowel(vowel); switch (vowel) { case Vowel.ㅏ: Assert.Equal(Vowel.ㅏ, shortVowel); break; case Vowel.ㅐ: Assert.Equal(Vowel.ㅐ, shortVowel); break; case Vowel.ㅑ: Assert.Equal(Vowel.ㅏ, shortVowel); break; case Vowel.ㅒ: Assert.Equal(Vowel.ㅐ, shortVowel); break; case Vowel.ㅓ: Assert.Equal(Vowel.ㅓ, shortVowel); break; case Vowel.ㅔ: Assert.Equal(Vowel.ㅔ, shortVowel); break; case Vowel.ㅕ: Assert.Equal(Vowel.ㅓ, shortVowel); break; case Vowel.ㅖ: Assert.Equal(Vowel.ㅔ, shortVowel); break; case Vowel.ㅗ: Assert.Equal(Vowel.ㅗ, shortVowel); break; case Vowel.ㅘ: Assert.Equal(Vowel.ㅏ, shortVowel); break; case Vowel.ㅙ: Assert.Equal(Vowel.ㅐ, shortVowel); break; case Vowel.ㅚ: Assert.Equal(Vowel.ㅔ, shortVowel); break; case Vowel.ㅛ: Assert.Equal(Vowel.ㅗ, shortVowel); break; case Vowel.ㅜ: Assert.Equal(Vowel.ㅜ, shortVowel); break; case Vowel.ㅝ: Assert.Equal(Vowel.ㅓ, shortVowel); break; case Vowel.ㅞ: Assert.Equal(Vowel.ㅔ, shortVowel); break; case Vowel.ㅟ: Assert.Equal(Vowel.ㅣ, shortVowel); break; case Vowel.ㅠ: Assert.Equal(Vowel.ㅜ, shortVowel); break; case Vowel.ㅡ: Assert.Equal(Vowel.ㅡ, shortVowel); break; case Vowel.ㅢ: Assert.Equal(Vowel.ㅣ, shortVowel); break; case Vowel.ㅣ: Assert.Equal(Vowel.ㅣ, shortVowel); break; } } }
/// <summary> /// 한글의 자음, 모음, 받침을 한 문자로 조합합니다. /// </summary> /// <param name="consonant"></param> /// <param name="vowel"></param> /// <param name="finalConsonant"></param> /// <returns></returns> public static char Merge(Consonant consonant, Vowel vowel, FinalConsonant finalConsonant = FinalConsonant.None) => (char)Merge((int)consonant, (int)vowel, (int)finalConsonant);