private static void TestProcess(string configFile) { // init Console.WriteLine("----- Test Process Text: -----"); string inText = "We cant theredve spel and 987Pfimbria dianosed.Plz u r good123. "; CSpellApi cSpellApi = new CSpellApi(configFile); string outText = cSpellApi.ProcessToStr(inText); // print out Console.WriteLine("--------- CSpellApi( ) -----------"); Console.WriteLine("In: [" + inText + "]"); Console.WriteLine("Out: [" + outText + "]"); }
// privat methods private static void Test(string configFile) { // init Console.WriteLine("----- Test Pre-Correction Text: -----"); string inText = "We cant theredve hell.Plz u r good123. "; CSpellApi cSpellApi = new CSpellApi(configFile); int ndMaxSplitNo = cSpellApi.GetCanNdMaxSplitNo(); Dictionary <string, string> infExpMap = cSpellApi.GetInformalExpressionMap(); string outText = ProcessByStr(inText, ndMaxSplitNo, infExpMap); // print out Console.WriteLine("--------------------"); Console.WriteLine("In: [" + inText + "]"); Console.WriteLine("Out: [" + outText + "]"); }
// test driver public static void MainTest(string[] args) { string configFile = "../data/Config/cSpell.properties"; if (args.Length == 1) { configFile = args[0]; } else if (args.Length > 0) { Console.WriteLine("Usage: java CorrectionApi <configFile>"); Environment.Exit(0); } // init, read in from config CSpellApi cSpellApi = new CSpellApi(configFile); Test(cSpellApi); }
// privat methods private static void Test(CSpellApi cSpellApi) { Console.WriteLine("----- Test Pre-Correction Text: -----"); string inText = "We cant spel ACHindex 987Pfimbria dianosed."; //CSpellApi cSpellApi = new CSpellApi(configFile); List <TokenObj> inTokenList = TextObj.TextToTokenList(inText); List <TokenObj> outTokenList = ProcessByTokenObj(inTokenList, cSpellApi); string outText = TextObj.TokenListToText(outTokenList); // print out Console.WriteLine("--------------------"); Console.WriteLine("In: [" + inText + "]"); Console.WriteLine("Out: [" + outText + "]"); Console.WriteLine("----- Details -----------"); int index = 0; foreach (TokenObj tokenObj in outTokenList) { Console.WriteLine(index + "|" + tokenObj.ToString()); index++; } }
// Core method: of spell-correction, include split public static List <TokenObj> ProcessByTokenObj(List <TokenObj> inTokenList, CSpellApi cSpellApi, bool debugFlag) { return(ProcCorrector.ProcessByTokenObj(inTokenList, cSpellApi, debugFlag)); }
public static List <TokenObj> ProcessByTokenObj(List <TokenObj> inTokenList, CSpellApi cSpellApi) { bool debugFlag = false; return(ProcessByTokenObj(inTokenList, cSpellApi, debugFlag)); }
// Correction public static string ProcessToStr(string inText, CSpellApi cSpellApi) { bool debugFlag = false; return(ProcessToStr(inText, cSpellApi, debugFlag)); }