using UnityEngine;
using System.Collections;
using System.Collections.Generic;
using System.Text.RegularExpressions;
public class Vocabulary : MonoBehaviour {
private int mood; // 心情變數
public int moodType {
get { return mood; }
}
Regex biologicalHerbivorousReget, biologicalCarnivorousReget, biologicalOmnivoreReget; // 生物字串分割
Regex personalRegex; // 人稱字串分割
Regex familyTitleRegex; // 家族職稱字串分割
/// <summary>
/// 家族職稱類方法
/// </summary>
/// <param 句子="家族職稱關鍵字"></param>
public void familyTitleFunction(string familyTileName) {
string[] familyTitleType = new string[] { "哥", "弟", "姊", "妹", "爸", "媽", "奶", "公", "嬤", "奶奶", "爺", "叔", "叔叔", "舅" };
// list 加入家族職稱陣列裡面數值
List<string> familTiles = new List<string>();
for (int x = 0; x < familyTitleType.Length; x++)
familTiles.Add(familyTitleType[x]);
// 字串分割之後判斷是否家族職稱
foreach (string result in familTiles){
familyTitleRegex = new Regex(result);
string[] splitResult = familyTitleRegex.Split(familyTileName);
foreach (string splitResultType in splitResult)
if (familyTileName != splitResultType)
Debug.Log(familyTitleRegex.ToString());
}
}
/// <summary>
/// 人稱類方法
/// </summary>
/// <param 句子="人稱關鍵字"></param>
public void personalNounFunction(string personalName) {
string[] personalType = new string[] { "你", "我", "他", "您", "咱", "妳", "您", "她", "它" };
// list 加入人稱陣列裡面數值
List<string> personalNouns = new List<string>();
for (int x = 0; x < personalType.Length; x++)
personalNouns.Add(personalType[x]);
// 字串分割之後判斷是否人稱
foreach (string result in personalNouns) {
personalRegex = new Regex(result);
string[] splitResult = personalRegex.Split(personalName);
foreach (string splitResultType in splitResult)
if (personalName != splitResultType)
Debug.Log("人稱");
}
}
/// <summary>
/// 生物類方法(雜食、草食、肉食)
/// </summary>
/// <param 句子="動物關鍵字"></param>
public void biologicalFunction(string animalName) {
string[] biologicalHerbivorousType = new string[] { "羊", "牛", "馬", "鹿", "象", "兔", "駝"};
string[] biologicalCarnivorousType = new string[] { "獅", "虎", "豹", "貓", "狼", "鱷", "鷹", "蛇", "鯊", "熊", "鯨", "食人" };
string[] biologicalOmnivoreType = new string[] { "人", "猴", "猩", "雞", "鳥", "豬", "鼠", "蜥", "鴨", "雀", "蛙", "犬", "狗" };
// list 加入草食性生物陣列裡面數值
List<string> animalHerbivorous = new List<string>();
for (int x = 0; x < biologicalHerbivorousType.Length; x++)
animalHerbivorous.Add(biologicalHerbivorousType[x]);
// 字串分割之後判斷是否草食性生物
foreach (string result in animalHerbivorous){
biologicalHerbivorousReget = new Regex(result);
string[] splitResult = biologicalHerbivorousReget.Split(animalName);
foreach (string splitResultType in splitResult)
if (animalName != splitResultType)
Debug.Log("草食性生物");
//mood = 1;
}
// list 加入肉食性生物陣列裡面數值
List<string> animalCarnivorous = new List<string>();
for (int x = 0; x < biologicalCarnivorousType.Length; x++)
animalCarnivorous.Add(biologicalCarnivorousType[x]);
// 字串分割之後判斷是否肉食性生物
foreach (string result in animalCarnivorous){
biologicalCarnivorousReget = new Regex(result);
string[] splitResult = biologicalCarnivorousReget.Split(animalName);
foreach (string splitResultType in splitResult)
if (animalName != splitResultType)
Debug.Log("肉食性生物");
}
// List 加速雜食性生物陣列裡面數值
List<string> biologicalOmnivore = new List<string>();
for (int x = 0; x < biologicalOmnivoreType.Length; x++)
biologicalOmnivore.Add(biologicalOmnivoreType[x]);
foreach (string result in biologicalOmnivore) {
biologicalOmnivoreReget = new Regex(result);
string[] splitResult = biologicalOmnivoreReget.Split(animalName);
foreach (string splitResultType in splitResult)
if (animalName != splitResultType)
Debug.Log("雜食性生物");
}
}
}
------------------------------
輸入 他是我爸
找出: 爸 關鍵字
沒有留言:
張貼留言