Example #1
0
        //====================================================================
        // 准备PositionMap,用于记录词的位置
        //====================================================================
        private static int[] PreparePositionMap(RowFirstDynamicArray <ChainContent> aWord)
        {
            int[] m_npWordPosMapTable;
            ChainItem <ChainContent> pTail, pCur;
            int nWordIndex = 0, m_nWordCount;

            //Get tail element and return the words count
            m_nWordCount = aWord.GetTail(out pTail);

            if (m_nWordCount > 0)
            {
                m_npWordPosMapTable = new int[m_nWordCount];
            }
            else
            {
                m_npWordPosMapTable = null;
            }

            //Record the  position of possible words
            pCur = aWord.GetHead();
            while (pCur != null)
            {
                m_npWordPosMapTable[nWordIndex++] = pCur.row * Predefine.MAX_SENTENCE_LEN + pCur.col;
                pCur = pCur.next;
            }

            return(m_npWordPosMapTable);
        }