//Load all records and generate features public EncoderTagger[] ReadAllRecords() { var arrayEncoderTagger = new EncoderTagger[trainCorpusList.Count]; var arrayEncoderTaggerSize = 0; //Generate each record features Parallel.For(0, trainCorpusList.Count, parallelOption, i => { var _x = new EncoderTagger(this); if (_x.GenerateFeature(trainCorpusList[i]) == false) { Logger.WriteLine("Load a training sentence failed, skip it."); } else { var oldValue = Interlocked.Increment(ref arrayEncoderTaggerSize) - 1; arrayEncoderTagger[oldValue] = _x; if (oldValue % 10000 == 0) { //Show current progress on console Console.Write("{0}...", oldValue); } } }); trainCorpusList.Clear(); trainCorpusList = null; Console.WriteLine(); return(arrayEncoderTagger); }
//Load all records and generate features public EncoderTagger[] ReadAllRecords() { EncoderTagger[] arrayEncoderTagger = new EncoderTagger[trainCorpusList.Count]; int arrayEncoderTaggerSize = 0; //Generate each record features #if NO_SUPPORT_PARALLEL_LIB for (int i = 0;i < trainCorpusList.Count;i++) #else Parallel.For(0, trainCorpusList.Count, parallelOption, i => #endif { EncoderTagger _x = new EncoderTagger(this); if (_x.GenerateFeature(trainCorpusList[i]) == false) { Console.WriteLine("Load a training sentence failed, skip it."); } else { int oldValue = Interlocked.Increment(ref arrayEncoderTaggerSize) - 1; arrayEncoderTagger[oldValue] = _x; if (oldValue % 10000 == 0) { //Show current progress on console Console.Write("{0}...", oldValue); } } } #if NO_SUPPORT_PARALLEL_LIB #else ); #endif trainCorpusList.Clear(); trainCorpusList = null; Console.WriteLine(); return arrayEncoderTagger; }
//Load all records and generate features public EncoderTagger[] ReadAllRecords() { var arrayEncoderTagger = new EncoderTagger[trainCorpusList.Count]; var arrayEncoderTaggerSize = 0; //Generate each record features #if NO_SUPPORT_PARALLEL_LIB for (int i = 0;i < trainCorpusList.Count;i++) #else Parallel.For(0, trainCorpusList.Count, parallelOption, i => #endif { var _x = new EncoderTagger(this); if (_x.GenerateFeature(trainCorpusList[i]) == false) { Console.WriteLine("Load a training sentence failed, skip it."); } else { var oldValue = Interlocked.Increment(ref arrayEncoderTaggerSize) - 1; arrayEncoderTagger[oldValue] = _x; if (oldValue % 10000 == 0) { //Show current progress on console Console.Write("{0}...", oldValue); } } } #if NO_SUPPORT_PARALLEL_LIB #else ); #endif trainCorpusList.Clear(); trainCorpusList = null; Console.WriteLine(); return arrayEncoderTagger; }