private static void TestSplit(CSpellApi cSpellApi)
        {
            // setup test case
            // 10349.txt
            //String inText = "sounding in my ear every time for along time.";
            // 13864.txt
            string          inText            = "I donate my self to be apart of this study.";
            TextObj         textObj           = new TextObj(inText);
            List <TokenObj> inTextList        = textObj.GetTokenList();
            List <TokenObj> nonSpaceTokenList = TextObj.GetNonSpaceTokenObjList(inTextList);
            //int tarPos = 7;
            int      tarPos     = 6;
            TokenObj inTokenObj = nonSpaceTokenList[tarPos];
            bool     debugFlag  = false;

            Console.WriteLine("====== Real-Word One-To-One Correction Test =====");
            Console.WriteLine("-- inTextList: [" + inText + "]");
            Console.WriteLine("-- tarPos: [" + tarPos + "]");
            Console.WriteLine("-- inTokenObj: [" + inTokenObj.ToString() + "]");
            // get the correct term
            TokenObj outTokenObj = GetCorrectTerm(inTokenObj, cSpellApi, debugFlag, tarPos, nonSpaceTokenList);

            // print out
            Console.WriteLine("--------- GetCorrectTermStr( ) -----------");
            Console.WriteLine("-- outTokenObj: [" + outTokenObj.ToString() + "]");
        }
Пример #2
0
        private static void Test1To1(CSpellApi cSpellApi)
        {
            // setup test case
            // 51.txt
            //String inText = "You'd thing that this is good.";
            //String inText = "The doctor thing that this is good.";
            string          inText            = "you would thing that is good.";
            TextObj         textObj           = new TextObj(inText);
            List <TokenObj> inTextList        = textObj.GetTokenList();
            List <TokenObj> nonSpaceTokenList = TextObj.GetNonSpaceTokenObjList(inTextList);
            int             tarPos            = 2;
            TokenObj        inTokenObj        = nonSpaceTokenList[tarPos];
            bool            debugFlag         = false;

            Console.WriteLine("====== Real-Word One-To-One Correction Test =====");
            Console.WriteLine("-- inTextList: [" + inText + "]");
            Console.WriteLine("-- tarPos: [" + tarPos + "]");
            Console.WriteLine("-- inTokenObj: [" + inTokenObj.ToString() + "]");
            // get the correct term
            TokenObj outTokenObj = GetCorrectTerm(inTokenObj, cSpellApi, debugFlag, tarPos, nonSpaceTokenList);

            // print out
            Console.WriteLine("--------- GetCorrectTermStr( ) -----------");
            Console.WriteLine("-- outTokenObj: [" + outTokenObj.ToString() + "]");
        }