예제 #1
0
        /**
         * @brief Split the input text and convert to float array.
         */
        public float[] SplitStr(string str)
        {
            float[] float_array = new float[256];
            int     cnt, len, start, unknown, pad, value;

            start   = Int32.Parse((string)ht["<START>"]);
            pad     = Int32.Parse((string)ht["<PAD>"]);
            unknown = Int32.Parse((string)ht["<UNKNOWN>"]);

            float_array[0] = (float)start;

            /*Split words and conver to lowercase */
            string[] words = str.ToLower().Split(' ');
            len = words.Length;

            for (cnt = 1; cnt <= len; cnt++)
            {
                /* Check words and fill the float array with proper values */
                if (ht.ContainsKey(words[cnt - 1]))
                {
                    value            = Int32.Parse((string)ht[words[cnt - 1]]);
                    float_array[cnt] = (float)value;
                }
                else
                {
                    Log.Debug(TAG, "Given word is not contained.");
                    float_array[cnt] = (float)unknown;
                }
            }
            /* Remainers are filled with 0*/
            while (cnt < 256)
            {
                float_array[cnt++] = (float)pad;
            }
            return(float_array);
        }
예제 #2
0
        public void Debug(string message, string file = "", string func = "", int line = 0)
        {
#if PRINT_DEBUG
            Native.Debug("ClockDotNet", message, file, func, line);
#endif
        }