void Update() { // 发射前(淡入过程中) if (!this.is_launched) { float delay = 0.5f; // 通过修改alpha通道值淡入 Color color = this.GetComponent <Renderer>().material.color; // 将[0.0f ~ delay] 范围变换为 [0.0f ~ 1.0f] float t = Mathf.InverseLerp(0.0f, delay, this.time); t = Mathf.Min(t, 1.0f); color.a = Mathf.Lerp(0.0f, 1.0f, t); this.GetComponent <Renderer>().material.color = color; // 经过一定时间后,发射 if (this.time >= delay) { this.GetComponent <Rigidbody>().useGravity = true; this.GetComponent <Rigidbody>().velocity = this.velocity; this.is_launched = true; } } this.time += Time.deltaTime; DebugPrint.print(this.GetComponent <Rigidbody>().velocity.ToString()); }
public void Dump(DebugPrint debug_print) { Queue <UnitSchedulable> curr; int count; Queue <UnitSchedulable> first = null; for (count = 0; count < this.calendar.Length; count++) { curr = this.GetNextQueue(); if (curr == null) { break; } if (first == null) { first = curr; } else if (first == curr) { break; } foreach (UnitSchedulable h in curr) { debug_print(this.time.ToString() + " " + h.ToString()); } } debug_print("----done----"); }
void Update() { // 発射される前だったら(フェードイン中だったら)……. if (!this.is_launched) { float delay = 0.5f; // アルファーでフェードインする. Color color = this.GetComponent <Renderer>().material.color; // [0.0f ~ delay] の範囲を [0.0f ~ 1.0f] に変換する float t = Mathf.InverseLerp(0.0f, delay, this.time); t = Mathf.Min(t, 1.0f); color.a = Mathf.Lerp(0.0f, 1.0f, t); this.GetComponent <Renderer>().material.color = color; // 一定時間が経過したら、発射. if (this.time >= delay) { this.GetComponent <Rigidbody>().useGravity = true; this.GetComponent <Rigidbody>().velocity = this.velocity; this.is_launched = true; } } this.time += Time.deltaTime; DebugPrint.print(this.GetComponent <Rigidbody>().velocity.ToString()); }
public static bool IsRealWord(string inWord, CSpellApi cSpellApi, bool debugFlag) { // init RootDictionary checkDic = cSpellApi.GetCheckDic(); RootDictionary unitDic = cSpellApi.GetUnitDic(); WordWcMap wordWcMap = cSpellApi.GetWordWcMap(); Word2Vec word2VecOm = cSpellApi.GetWord2VecOm(); int inWordLen = inWord.Length; // TBD, change method name int rwSplitWordMinLength = cSpellApi.GetDetectorRwSplitWordMinLength(); int rwSplitWordMinWc = cSpellApi.GetDetectorRwSplitWordMinWc(); // realword must be: // 1. known in the dictionary // 2. not exception, such as url, email, digit, ... // => if excpetion, even is a non-word, no correction // 3. must have word2Vector value (inWord is auto converted to LC) // 4. frequency must be above a threshhold (inWord is auto to LC) // TBD, need to be configureable 200 bool realWordFlag = (checkDic.IsValidWord(inWord)) && (!IsRealWordExceptions(inWord, unitDic) && (inWordLen >= rwSplitWordMinLength) && (word2VecOm.HasWordVec(inWord) == true) && (WordCountScore.GetWc(inWord, wordWcMap) >= rwSplitWordMinWc)); if (debugFlag == true) { bool wordInDicFlag = checkDic.IsValidWord(inWord); bool wordExceptionFlag = IsRealWordExceptions(inWord, unitDic); bool lengthFlag = (inWordLen >= rwSplitWordMinLength); bool word2VecFlag = word2VecOm.HasWordVec(inWord); bool wcFlag = (WordCountScore.GetWc(inWord, wordWcMap) >= rwSplitWordMinWc); DebugPrint.PrintRwSplitDetect(inWord, realWordFlag, wordInDicFlag, wordExceptionFlag, lengthFlag, word2VecFlag, wcFlag, debugFlag); } return(realWordFlag); }
protected override void OnInitialized() { Service.IsMakingRequest += (sender, evnt) => { isLoading = evnt.IsLoading; DebugPrint.Log("IsMakingRequest: " + evnt.IsLoading.ToString()); }; }
void Start() { var dagger = new Dagger(); var curse = new Curse(); DebugPrint.PrintAnyDamageSubject(dagger); // dagger damage info DebugPrint.PrintAnyDamageSubject(curse); // curse damage info }
/// <summary> /// cSpell correction process, output to an ArrayList of TokenObj by using /// funcMode and rankMode from configuratin files, with debug print option. /// </summary> /// <param name="inText"> input text to be corrected </param> /// <param name="debugFlag"> boolean flag for debug print </param> /// <returns> an ArrayList of TokenObj </returns> public virtual List <TokenObj> ProcessToTokenObj(string inText, bool debugFlag) { DebugPrint.Println("====== SpellApi.Process( ), funcMode: " + funcMode_ + ", rankMode: " + rankMode_ + " ======", debugFlag); // non-dictionary and dictionary base correction List <TokenObj> inTokenList = TextObj.TextToTokenList(inText); List <TokenObj> outTokenList = CorrectionApi.ProcessByTokenObj(inTokenList, this, debugFlag); return(outTokenList); }
// public method /// <summary> /// The core method to correct a word by following steps: /// <ul> /// <li>Convert inToken to coreTerm /// <li>detect if real-word /// <li>get candidates /// <ul> /// <li>get candidates from one-to-one. /// </ul> /// <li>Rank candidates /// <ul> /// <li>context /// </ul> /// <li>Update information /// /// </ul> /// </summary> /// <param name="inTokenObj"> the input tokenObj (single word) </param> /// <param name="cSpellApi"> CSpell Api object </param> /// <param name="debugFlag"> flag for debug print </param> /// <param name="tarPos"> the position for target token </param> /// <param name="nonSpaceTokenList"> token list without space token(s) /// </param> /// <returns> the corrected word in tokenObj if suggested word found. /// Otherwise, the original input token is returned. </returns> // return the original term if no good correctin are found public static TokenObj GetCorrectTerm(TokenObj inTokenObj, CSpellApi cSpellApi, bool debugFlag, int tarPos, List <TokenObj> nonSpaceTokenList) { // init int funcMode = cSpellApi.GetFuncMode(); // get inWord from inTokenObj and init outTokenObj string inWord = inTokenObj.GetTokenStr(); TokenObj outTokenObj = new TokenObj(inTokenObj); // 1. convert a word to coreTerm (no leading/ending space, punc, digit) int ctType = CoreTermUtil.CT_TYPE_SPACE_PUNC_DIGIT; CoreTermObj coreTermObj = new CoreTermObj(inWord, ctType); string coreStr = coreTermObj.GetCoreTerm(); // 2. real-word detection and correction // check if the coreTerm is real-word if ((inTokenObj.GetProcHist().Count == 0) && (RealWord1To1Detector.IsDetect(inWord, coreStr, cSpellApi, debugFlag) == true)) { cSpellApi.UpdateDetectNo(); // TBD, should take care of possessive xxx's here // 3 get 1-to-1 candidates set from correction // TBD. realWordFlag to use metaphone ... // this process is very slow, 7 min., need to improved HashSet <string> candSet = RealWord1To1Candidates.GetCandidates(coreStr, cSpellApi); /// <summary> ///** development analysis print out to see total RW /// totalRwNo_++; /// int candSize = candSet.size(); /// if(candSize != 0) /// { /// totalCandNo_ += candSize; /// maxCandSize_ /// = ((candSize > maxCandSize_)?candSize:maxCandSize_); /// System.out.println("---- totalRwNo|totalCandNo(" + coreStr /// + "): " + totalRwNo_ + "|" + candSize + "|" /// + totalCandNo_ + "|" + maxCandSize_); /// System.out.println(candSet); /// } /// *** /// </summary> // 4. Ranking: get top ranked candidates as corrected terms // in case of using context string topRankStr = RankRealWord1To1ByCSpell.GetTopRankStr(coreStr, candSet, cSpellApi, tarPos, nonSpaceTokenList, debugFlag); // 5 update coreTerm and convert back to tokenObj coreTermObj.SetCoreTerm(topRankStr); string outWord = coreTermObj.ToString(); // 6. update info if there is a real-word correction if (inWord.Equals(outWord, StringComparison.OrdinalIgnoreCase) == false) { cSpellApi.UpdateCorrectNo(); outTokenObj.SetTokenStr(outWord); outTokenObj.AddProcToHist(TokenObj.HIST_RW_1); // 1-to-1 DebugPrint.PrintCorrect("RW", "RealWord1To1Corrector", inWord, outWord, debugFlag); } } return(outTokenObj); }
public virtual void AddDictionaries2(string inFiles, bool debugFlag) { DebugPrint.Println("- Dictionary Files: [" + inFiles + "].", debugFlag); string[] inFileStrArray = inFiles.Split("|", true); foreach (var item in inFileStrArray) { DebugPrint.Println("--- Add Dictionary: [" + item + "].", debugFlag); AddDictionary(item); } }
public virtual void AddDictionaries(string inFilePaths, bool debugFlag) { DebugPrint.Println("- Dictionary Files: [" + inFilePaths + "].", debugFlag); string[] inFileStrArray = inFilePaths.Split(":", true); foreach (string inFileStr in inFileStrArray) { DebugPrint.Println("--- Add Dictionary: [" + inFileStr + "].", debugFlag); AddDictionary(inFileStr); } }
//private RenderFragment ShowSpinner(bool yes) //{ // var icon = new RenderFragment((builder) => { // builder.OpenComponent(1, typeof(Spinner)); // builder.AddAttribute(2,"Size", "24"); // builder.CloseComponent(); // }); // DebugPrint.Log("Show Spinner: " + yes.ToString()); // return yes ? icon : null; //} private async Task HandleValidSubmit() { DebugPrint.Log("HandleValidSubmit clicked"); isLoading = true; StateHasChanged(); // ShowSpinner(true); //await Task.Delay(2500); //ShowSpinner(false); //DebugPrint.Log("HandleValidSubmit Fim"); }
// public method // the input mergeObjList is in the same order of index as inTokenList // TBD: has bug: "imple ment ation" => implementimplementation public static List <TokenObj> CorrectTokenListByMerge(List <TokenObj> inTokenList, List <MergeObj> mergeObjList, string procHistStr, bool debugFlag, CSpellApi cSpellApi) { // 0. unify the mergeObjList to remove contain and overlap List <MergeObj> mergeObjListC = CleanUpMergeObjList(mergeObjList); List <TokenObj> outTokenList = new List <TokenObj>(); // 1. go through all mergeObj int curIndex = 0; foreach (MergeObj mergeObj in mergeObjListC) { //System.out.println(mergeObj.ToString()); int startIndex = mergeObj.GetStartIndex(); int endIndex = mergeObj.GetEndIndex(); // 1. update tokens before merge start for (int i = curIndex; i < startIndex; i++) { outTokenList.Add(inTokenList[i]); } // 2. update merge at target string mergeWord = mergeObj.GetMergeWord(); string orgMergeWord = mergeObj.GetOrgMergeWord(); string tarWord = mergeObj.GetTarWord(); TokenObj mergeTokenObj = new TokenObj(orgMergeWord, mergeWord); // update process history for (int i = startIndex; i <= endIndex; i++) { // merge focus token if (i == mergeObj.GetTarIndex()) { cSpellApi.UpdateCorrectNo(); mergeTokenObj.AddProcToHist(procHistStr + TokenObj.MERGE_START_STR + tarWord + TokenObj.MERGE_END_STR); //DebugPrint.PrintCorrect("NW", DebugPrint.PrintCorrect(procHistStr, "MergeCorrector (" + tarWord + ")", orgMergeWord, mergeWord, debugFlag); } else // not merge focus token, context { TokenObj contextToken = inTokenList[i]; List <string> contextProcHist = contextToken.GetProcHist(); foreach (string procHist in contextProcHist) { mergeTokenObj.AddProcToHist(procHist + TokenObj.MERGE_START_STR + contextToken.GetTokenStr() + TokenObj.MERGE_END_STR); } } } outTokenList.Add(mergeTokenObj); curIndex = endIndex + 1; } // 2. add tokens after the last merge Obj for (int i = curIndex; i < inTokenList.Count; i++) { outTokenList.Add(inTokenList[i]); } return(outTokenList); }
public ZigZagTest(ZigZag CurrentTest) { InitializeComponent(); Test = CurrentTest; Test.OnStateChanged = new StateChanged(SetNewInstructions); NMEAParser.OnCourseUpdated += new UpdateCOG(this.RotationUpdated); NMEAParser.OnSpeedUpdated += new UpdateSOG(this.VelocityUpdated); PrintToTestWindow += new DebugPrint(DebugPrintToLabel); }
public virtual void AddDictionaries(string inFiles, string rootPath, bool debugFlag) { DebugPrint.Println("- Dictionary Files: [" + inFiles + "].", debugFlag); string[] inFileStrArray = inFiles.Split(":", true); foreach (string inFileStr in inFileStrArray) { string inDicFile = rootPath + inFileStr; DebugPrint.Println("--- Add Dictionary: [" + inDicFile + "].", debugFlag); AddDictionary(inDicFile); } }
async Task HandleRegister() { var apiResponse = await Service.Post <Command, ApiResponse <Result> >(registerCommand, "/api/authenticate/register"); if (apiResponse.Succeeded) { DebugPrint.Log(apiResponse); await TokenService.StoreToken(new AppShared.Model.LocalUserInfo() { Id = apiResponse.Result.UserId, AccessToken = apiResponse.Result.AccessToken }); try { var response = await DialogService.OpenAsync <SimpleConfirm>($"Your access is granted!", new Dictionary <string, object>() { { "Description", new string[] { // $"The Id: {apiResponse.Result.UserId} is your identifier", "You will need create your incidents. You will be redirected to your Profile page.", "Keep your password safe!" } } } ); if ((bool)response) { Navigator.NavigateTo("/profile", forceLoad: true); } else { Navigator.NavigateTo("/", forceLoad: true); } } catch (Exception ex) { DebugPrint.Log("Error on HandleRegister."); DebugPrint.Log($"HandleRegister:: [] \n{ex.Message}"); Console.WriteLine(ex.Message); } finally { isLoading = false; } } else { var response = await DialogService.OpenAsync <SimpleConfirm>($"There was a problem!", new Dictionary <string, object>() { { "Description", apiResponse.Message.Split('\n').ToArray() } } ); } }
// public method // process public static List <TokenObj> Process(List <TokenObj> inTokenList, CSpellApi cSpellApi, bool debugFlag) { DebugPrint.PrintProcess("5. RealWord-Merge", debugFlag); DebugPrint.PrintInText(TextObj.TokenListToText(inTokenList), debugFlag); // pre-porcess // update Pos for the inTokenList TextObj.UpdateIndexPos(inTokenList); // 1. remove non space-token and convert to non-space-token list List <TokenObj> nonSpaceTokenList = TextObj.GetNonSpaceTokenObjList(inTokenList); // 2. process: go through each token for detection and correction // to find merge corrections (mergeObjList) int index = 0; List <MergeObj> mergeObjList = new List <MergeObj>(); int maxLegitTokenLength = cSpellApi.GetMaxLegitTokenLength(); while (index < inTokenList.Count) { TokenObj curTokenObj = inTokenList[index]; // update the tarPos // SCR-3, use legit token if (curTokenObj.IsLegitToken(maxLegitTokenLength) == true) { int tarPos = inTokenList[index].GetPos(); // correct term is the highest ranked candidates MergeObj mergeObj = RealWordMergeCorrector.GetCorrectTerm(tarPos, nonSpaceTokenList, cSpellApi, debugFlag); if (mergeObj == null) // no merge correction { index++; } else // has merge correction { mergeObjList.Add(mergeObj); // next token after end token, this ensures no overlap merge index = mergeObj.GetEndIndex() + 1; } } else // space token // update index { index++; } } // update the output for merge for the whole inTokenList, // has to update after the loop bz merge might // happen to the previous token // update the tokenObj up to the merge, then go to the next token // update operation info also List <TokenObj> outTokenList = MergeCorrector.CorrectTokenListByMerge(inTokenList, mergeObjList, TokenObj.HIST_RW_M, debugFlag, cSpellApi); return(outTokenList); }
// TBD, this file should be deleted by moving each method to // the assocaited ranking class // public method public static void PrintContextScore(HashSet <string> candSet, int tarPos, int tarSize, List <TokenObj> inTextList, Word2Vec word2VecIm, Word2Vec word2VecOm, bool word2VecSkipWord, int contextRadius, int maxCandNo, bool debugFlag) { if (debugFlag == true) { ContextScoreComparator <ContextScore> csc = new ContextScoreComparator <ContextScore>(); HashSet <ContextScore> cScoreSet = RankByContext.GetCandidateScoreSet(candSet, tarPos, tarSize, inTextList, word2VecIm, word2VecOm, word2VecSkipWord, contextRadius, debugFlag); var list = cScoreSet.OrderBy(x => x, csc).Take(maxCandNo).Select(obj => obj.ToString()).ToList(); foreach (var item in list) { DebugPrint.PrintCScore(item, debugFlag); } } }
public static void PrintFrequencyScore(HashSet <string> candSet, WordWcMap wordWcMap, int maxCandNo, bool debugFlag) { if (debugFlag == true) { FrequencyScoreComparator <FrequencyScore> fsc = new FrequencyScoreComparator <FrequencyScore>(); HashSet <FrequencyScore> fScoreSet = RankByFrequency.GetCandidateScoreSet(candSet, wordWcMap); var list = fScoreSet.OrderBy(x => x, fsc).Take(maxCandNo).Select(obj => obj.ToString()).ToList(); foreach (var item in list) { DebugPrint.PrintFScore(item, debugFlag); } } }
public static void PrintOrthographicScore(string inStr, HashSet <string> candSet, int maxCandNo, double wf1, double wf2, double wf3, bool debugFlag) { if (debugFlag == true) { OrthographicScoreComparator <OrthographicScore> osc = new OrthographicScoreComparator <OrthographicScore>(); HashSet <OrthographicScore> oScoreSet = RankByOrthographic.GetCandidateScoreSet(inStr, candSet, wf1, wf2, wf3); var list = oScoreSet.OrderBy(x => x, osc).Take(maxCandNo).Select(obj => obj.ToString()).ToList(); foreach (var item in list) { DebugPrint.PrintOScore(item, debugFlag); } } }
public static void PrintNoisyChannelScore(string inStr, HashSet <string> candSet, WordWcMap wordWcMap, int maxCandNo, double wf1, double wf2, double wf3, bool debugFlag) { if (debugFlag == true) { NoisyChannelScoreComparator <NoisyChannelScore> ncsc = new NoisyChannelScoreComparator <NoisyChannelScore>(); HashSet <NoisyChannelScore> ncScoreSet = RankByNoisyChannel.GetCandidateScoreSet(inStr, candSet, wordWcMap, wf1, wf2, wf3); var list = ncScoreSet.OrderBy(x => x, ncsc).Take(maxCandNo).Select(obj => obj.ToString()).ToList(); foreach (var item in list) { DebugPrint.PrintNScore(item, debugFlag); } } }
private static bool CheckRealWord1To1Rules(ContextScore topContextScore, string inStr, int tarPos, int tarSize, List <TokenObj> nonSpaceTokenList, Word2Vec word2VecIm, Word2Vec word2VecOm, bool word2VecSkipWord, int contextRadius, double rw1To1Factor, bool debugFlag) { // return false if no topCand found if ((topContextScore == null) || (topContextScore.GetTerm().Equals(inStr))) { return(false); } // 1. get the word2Vec score for the org inStr b4 one-to-one // 1.1 wordVec for context DoubleVec contextVec = Word2VecContext.GetContextVec(tarPos, tarSize, nonSpaceTokenList, word2VecIm, contextRadius, word2VecSkipWord, debugFlag); // 1.2 wordVec for the original words before one-to-one ContextScore orgCs = new ContextScore(inStr, contextVec, word2VecOm); DebugPrint.Println("--- Real-Word One-To-One Context Score Detail: ---", debugFlag); DebugPrint.Println("- Score - orgTerm: " + orgCs.ToString(), debugFlag); DebugPrint.Println("- Score - top 1-to-1: " + topContextScore.ToString(), debugFlag); DebugPrint.Println("- rw1To1Factor: " + rw1To1Factor, debugFlag); // Score rules for one-to-one double orgScore = orgCs.GetScore(); double topScore = topContextScore.GetScore(); bool flag = false; // 2.1 no one-to-one correction if orgScore is 0.0d, no word2Vec information if (orgScore < 0.0d) { // 2.2a one-to-one if the org score is negative and top score is positive if (topScore > 0.0d) { // another rule for word2Vec on real-word if (((topScore - orgScore) > 0.085) && (orgScore > -0.085)) // help from 0.6812 to 0.6877 { flag = true; } } // 2.2b one-to-one if the org score is negative and top score is better else if ((topScore < 0.0d) && (topScore > orgScore * rw1To1Factor)) { flag = true; } } else if (orgScore > 0.0d) { // 2.3a merge if the org score is positive and better 0.01*topScore if (topScore * rw1To1Factor > orgScore) { flag = true; } } return(flag); }
// ------------------------------------------------------------------------ // public static DebugPrint getInstance() { if(DebugPrint.instance == null) { GameObject go = new GameObject("DebugPrint"); DebugPrint.instance = go.AddComponent<DebugPrint>(); DebugPrint.instance.create(); DontDestroyOnLoad(go); } return(DebugPrint.instance); }
// ------------------------------------------------------------------------ // public static DebugPrint getInstance() { if (DebugPrint.instance == null) { GameObject go = new GameObject("DebugPrint"); DebugPrint.instance = go.AddComponent <DebugPrint>(); DebugPrint.instance.create(); DontDestroyOnLoad(go); } return(DebugPrint.instance); }
// this detail does not print how cSpell really fidn the top rank // it is sorted by CSpell score // CSpell use the cSpell score + context and frequency to find the top public static void PrintCSpellScore(string inStr, HashSet <string> candSet, WordWcMap wordWcMap, int maxCandNo, int tarPos, int tarSize, List <TokenObj> nonSpaceTokenList, Word2Vec word2VecIm, Word2Vec word2VecOm, bool word2VecSkipWord, int contextRadius, double wf1, double wf2, double wf3, bool debugFlag) { if (debugFlag == true) { // NW 1To1 CSpellScoreNw1To1Comparator <CSpellScore> csc = new CSpellScoreNw1To1Comparator <CSpellScore>(); HashSet <CSpellScore> cScoreSet = RankByCSpellNonWord.GetCandidateScoreSet(inStr, candSet, wordWcMap, tarPos, tarSize, nonSpaceTokenList, word2VecIm, word2VecOm, word2VecSkipWord, contextRadius, wf1, wf2, wf3, debugFlag); var list = cScoreSet.OrderBy(x => x, csc).Take(maxCandNo).Select(obj => obj.ToString()).ToList(); foreach (var item in list) { DebugPrint.PrintScore(item, debugFlag); } } }
public async Task StoreToken(LocalUserInfo localUserInfo) { try { await storageService.SetItemAsync(Constants.UserKey, localUserInfo); } catch (Exception ex) { DebugPrint.Log("StoreToken"); DebugPrint.Log(ex.Message); await storageService.ClearAsync(); } }
//============================================================================================== // 静态方法 /// <summary>获取该类的实例(Singleton)</summary> public static DebugPrint getInstance() { if (m_instance == null) { // 生成该类并附加到对象上 GameObject go = new GameObject("DebugPrint"); // 附加 m_instance = go.AddComponent <DebugPrint>(); // 在场景切换时不销毁该对象 DontDestroyOnLoad(go); } return(m_instance); }
//============================================================================================== // 静的メソッド. /// <summary>このクラスのインスタンスを取得する (Singleton)</summary> public static DebugPrint getInstance() { if (m_instance == null) { // このクラスをアタッチするオブジェクトを作る. GameObject go = new GameObject("DebugPrint"); // アタッチ m_instance = go.AddComponent <DebugPrint>(); // シーンを入れ替えてもこのオブジェクトが消えないようにする. DontDestroyOnLoad(go); } return(m_instance); }
public void judgeText(string text) { //テキストが数値かどうか判断するだけのものです。 //これが本来したい処理です。 try { double value = double.Parse(text); m_isNumber = true; } catch (FormatException e) { DebugPrint.output("sample", e.Message); m_isNumber = false; } }
public static TokenObj Process(TokenObj inTokenObj, Dictionary <string, string> informalExpMap, bool debugFlag) { string inTokenStr = inTokenObj.GetTokenStr(); string outTokenStr = ProcessWord(inTokenStr, informalExpMap); TokenObj outTokenObj = new TokenObj(inTokenObj); //update info if there is a process if (inTokenStr.Equals(outTokenStr) == false) { outTokenObj.SetTokenStr(outTokenStr); outTokenObj.AddProcToHist(TokenObj.HIST_ND_INFORMAL_EXP); DebugPrint.PrintCorrect("ND", "InformalExpHandler", inTokenStr, outTokenStr, debugFlag); } return(outTokenObj); }
public static TokenObj Process(TokenObj inTokenObj, int maxProcess, bool debugFlag) { string inTokenStr = inTokenObj.GetTokenStr(); string outTokenStr = Process(inTokenStr, maxProcess); TokenObj outTokenObj = new TokenObj(inTokenObj); //update info if there is a process if (inTokenStr.Equals(outTokenStr) == false) { outTokenObj.SetTokenStr(outTokenStr); outTokenObj.AddProcToHist(TokenObj.HIST_ND_S_E_P); DebugPrint.PrintCorrect("ND", "EndingPuncSplitter", inTokenStr, outTokenStr, debugFlag); } return(outTokenObj); }
// return candidate scoreObj list sorted by score, higher first public static List <ContextScore> GetCandidateScoreList(HashSet <MergeObj> candidates, List <TokenObj> nonSpaceTokenList, Word2Vec word2VecIm, Word2Vec word2VecOm, bool word2VecSkipWord, int contextRadius, bool debugFlag) { // find score object set for each candidates ... HashSet <ContextScore> candScoreSet = GetCandidateScoreSet(candidates, nonSpaceTokenList, word2VecIm, word2VecOm, word2VecSkipWord, contextRadius, debugFlag); // sorted by the score, higher go first List <ContextScore> candScoreList = new List <ContextScore>(candScoreSet); ContextScoreComparator <ContextScore> csc = new ContextScoreComparator <ContextScore>(); candScoreList.Sort(csc); // print detail foreach (ContextScore contextScore in candScoreList) { DebugPrint.PrintCScore(contextScore.ToString(), debugFlag); } return(candScoreList); }