コード例 #1
0
        private static List <string> GetContext(int tarPos, int tarSize, List <TokenObj> nonSpaceTokenList, Word2Vec w2vIm, int radius, bool word2VecSkipWord, bool debugFlag, bool allContext)
        {
            // normal TokenObj to string, use coreTerm.lc
            List <string> normTextList = new List <string>();

            if (nonSpaceTokenList != null)
            {
                foreach (TokenObj tokenObj in nonSpaceTokenList)
                {
                    // norm the token, such as [NUM], [URL], [EMAIL]
                    // TBD, should be done in pre-correction, preProcess
                    string normWord = NormWordForWord2Vec(tokenObj.GetTokenStr());
                    normTextList.Add(normWord);
                }
            }
            // get the context list by normStr (becasue normStr is key in w2v)
            List <string> contextList = GetContextForTar(tarPos, tarSize, normTextList, w2vIm, radius, word2VecSkipWord, allContext);

            DebugPrint.PrintContext(contextList, debugFlag);
            return(contextList);
        }