/**********/ void Start() { if (tree == null) { tree = new ABCTree(); } }
public void setTreeRoot(ABCSerializer.ABCNode rootNode) { if (tree == null) { tree = new ABCTree(); } tree.root = rootNode; }
/** * Procesa el diccionario recibido registrando todas las palabras: * Cada palabra viene en su propia linea **/ public void processDictionary(string text, int maxWordLength = 30) { Regex regex = new Regex(@"\r\n?|\n"); StringBuilder builder = new StringBuilder(regex.Replace(text, "\n").ToUpperInvariant()); //Quitamos toda la acentuacion y obtenemos un arreglo builder.Replace('Á', 'A').Replace('É', 'E').Replace('Í', 'I').Replace('Ó', 'O').Replace('Ú', 'U').Replace('Ü', 'U'); dictionaryWords = builder.ToString().Split('\n'); //Inicializamos la data de la estrcutura en blanco tree = new ABCTree(); initTime = Time.realtimeSinceStartup; //Descomentar para dividir el trabajo en frames StartCoroutine("registerDictionaryWords", maxWordLength); return; /* * int rejected = 0; * int l = dictionaryWords.Length; * //Registramos todas las palabras * for(int i = 0; i < l; i++) * { * if(dictionaryWords[i].Length < maxWordLength) * { * registerNewWord(dictionaryWords[i]); * } * else * { * rejected++; * } * } * * Debug.Log("Registered words: "+(l-rejected)); * Debug.Log("Rejected words by size: "+rejected); * Debug.Log("Dictionary finished in: "+ (Time.realtimeSinceStartup-initTime).ToString("0000.000")+"s"); * if(onDictionaryFinished != null) * { * onDictionaryFinished(); * }*/ }