public void Initilize() { var result = ResultDataManager.CurrentResult; var localResult = base.LocalID.DeSerializeLocalResult <ResultModel>(result.TaskID); if (localResult == null) { var value = WebAPI.Instance.GetMixedResult(result.TaskID); if (value.Item1) { localResult = value.Item2; } else { this.ErrorMessage = $"*{value.Item3}"; return; } } var cl = CommonDataManager.GetCLCase(base.LocalID); var rule = CommonDataManager.GetMixedRule(base.LocalID); var algo = CommonDataManager.GetMixedAlgoRule(base.LocalID); var rules = ResultAnalysis.GetResultRuleFitDegreeAnalysis(cl, rule, algo, localResult); int no = 0; rules?.ForEach(r => { r.NO = ++no; }); this.Rules = rules; }
public void Initilize() { var result = ResultDataManager.CurrentResult; var localResult = base.LocalID.DeSerializeLocalResult <ResultModel>(result.TaskID); if (localResult == null) { var value = WebAPI.Instance.GetAdminResult(result.TaskID); if (value.Item1) { localResult = value.Item2; } else { this.ErrorMessage = $"*{value.Item3}"; return; } } var rules = ResultAnalysis.GetSuggestResultRuleAnalysis(localResult); int no = 0; rules?.ForEach(r => { r.NO = ++no; }); this.Rules = rules; }
static GameStart() { _gameSettings = new GameSettings(); _gameSettings.ReadFromConfig(); _resultsAnalysis = new ResultAnalysis(_gameSettings); _randomGenerator = new RandomGenerator(_gameSettings.GameBoardWidth, _gameSettings.GameBoardHeight); }
private void generalAnalyze(List <GameResult> gameResults) { ResultAnalysis analysis = Analyze(gameResults); if (analysis.totalSuccess == 0) { possibleDialogue.Add(ResultCode.GEN_1); } else if (analysis.totalSuccess == 1) { possibleDialogue.Add(ResultCode.GEN_2); } else if (analysis.totalSuccess == 2) { possibleDialogue.Add(ResultCode.GEN_3); } else if (analysis.totalSuccess == 3) { possibleDialogue.Add(ResultCode.GEN_4); } else if (analysis.totalSuccess == 4) { possibleDialogue.Add(ResultCode.GEN_5); } else if (analysis.totalSuccess == 5) { possibleDialogue.Add(ResultCode.GEN_6); } else if (analysis.totalSuccess == 6) { possibleDialogue.Add(ResultCode.GEN_7); } else if (analysis.totalSuccess == 7) { possibleDialogue.Add(ResultCode.GEN_8); } else if (analysis.totalSuccess == 8) { possibleDialogue.Add(ResultCode.GEN_9); } if (analysis.gaList.Exists(x => x.chain == 3) && analysis.gaList.Find(x => x.chain == 3).success == 0) { possibleDialogue.Add(ResultCode.GEN_12); } if (analysis.resultList[analysis.resultList.Count - 1] == false) { possibleDialogue.Add(ResultCode.GEN_36); } if (analysis.resultList[analysis.resultList.Count - 1] == false && analysis.totalSuccess == 8) { possibleDialogue.Add(ResultCode.GEN_36); } }
private IEnumerator ThinkingAct(List <GameResult> gameResults) { ResultAnalysis analysis = Analyze(gameResults); finalResult = chooseFinalResult(analysis.finalScore, Subject.Thinking); generalAnalyze(gameResults); if (analysis.totalSuccess == 0) { possibleDialogue.Add(ResultCode.TNK_1); } else if (analysis.totalSuccess == 1) { possibleDialogue.Add(ResultCode.TNK_2); } else if (analysis.totalSuccess == 2) { possibleDialogue.Add(ResultCode.TNK_3); } else if (analysis.totalSuccess == 3) { possibleDialogue.Add(ResultCode.TNK_4); } else if (analysis.totalSuccess == 4) { possibleDialogue.Add(ResultCode.TNK_5); } else if (analysis.totalSuccess == 5) { possibleDialogue.Add(ResultCode.TNK_6); } else if (analysis.totalSuccess == 6) { possibleDialogue.Add(ResultCode.TNK_7); } else if (analysis.totalSuccess == 7) { possibleDialogue.Add(ResultCode.TNK_8); } else if (analysis.totalSuccess == 8) { possibleDialogue.Add(ResultCode.TNK_9); } if ((analysis.resultList[0] == true && analysis.resultList[1] == false && analysis.resultList[2] == true && analysis.resultList[3] == false && analysis.resultList[4] == true && analysis.resultList[5] == false && analysis.resultList[6] == true && analysis.resultList[7] == false && analysis.resultList[8] == true && analysis.resultList[9] == false) || (analysis.resultList[0] == false && analysis.resultList[1] == true && analysis.resultList[2] == false && analysis.resultList[3] == true && analysis.resultList[4] == false && analysis.resultList[5] == true && analysis.resultList[6] == false && analysis.resultList[7] == true && analysis.resultList[8] == false && analysis.resultList[9] == true)) { possibleDialogue.Add(ResultCode.TNK_12); } return(null); }
/// <summary> /// Revisa si la sintaxis del escenario es correcta, con la sentencia que fue construido el objeto /// </summary> /// <returns></returns> public bool CheckSyntaxB() { ResultAnalysis ra = SynAnalyzer.checkSyntax(); if (ra.Error.Count == 0) { return(true); } return(false); }
private IEnumerator QuicknessAct(List <GameResult> gameResults) { ResultAnalysis analysis = Analyze(gameResults); finalResult = chooseFinalResult(analysis.finalScore, Subject.Quickness); generalAnalyze(gameResults); if (analysis.totalSuccess == 0) { possibleDialogue.Add(ResultCode.QUK_1); } else if (analysis.totalSuccess == 1) { possibleDialogue.Add(ResultCode.QUK_2); } else if (analysis.totalSuccess == 2) { possibleDialogue.Add(ResultCode.QUK_3); } else if (analysis.totalSuccess == 3) { possibleDialogue.Add(ResultCode.QUK_4); } else if (analysis.totalSuccess == 4) { possibleDialogue.Add(ResultCode.QUK_5); } else if (analysis.totalSuccess == 5) { possibleDialogue.Add(ResultCode.QUK_6); } else if (analysis.totalSuccess == 6) { possibleDialogue.Add(ResultCode.QUK_7); } else if (analysis.totalSuccess == 7) { possibleDialogue.Add(ResultCode.QUK_8); } else if (analysis.totalSuccess == 8) { possibleDialogue.Add(ResultCode.QUK_9); } if (analysis.grList[analysis.grList.Count - 1].gameName.Equals("NEmain")) { possibleDialogue.Add(ResultCode.QUK_36); } return(null); }
private static void GameCompleted(ConsoleGame game) { Console.SetCursorPosition(0, _gameSettings.GameBoardHeight + 3); Console.WriteLine("Your score --> {0}", game.Score); if (_resultsAnalysis.CheckResult(game.Score)) { Console.WriteLine("Your name:"); string name = Console.ReadLine(); _resultsAnalysis.AddScore(game.Score, name); } _resultsAnalysis.ShowResults(); _gameSettings.ReadFromConfig(); _resultsAnalysis = new ResultAnalysis(_gameSettings); }
//같은 부류의 멘트은 else if로 묶을 것 (예 : if(1번 성공) else if(2번 성공) else if(3번 성공)...) private IEnumerator AimingAct(List <GameResult> gameResults) { ResultAnalysis analysis = Analyze(gameResults); finalResult = chooseFinalResult(analysis.finalScore, Subject.Aiming); generalAnalyze(gameResults); if (analysis.totalSuccess == 0) { possibleDialogue.Add(ResultCode.AIM_1); } else if (analysis.totalSuccess == 1) { possibleDialogue.Add(ResultCode.AIM_2); } else if (analysis.totalSuccess == 2) { possibleDialogue.Add(ResultCode.AIM_3); } else if (analysis.totalSuccess == 3) { possibleDialogue.Add(ResultCode.AIM_4); } else if (analysis.totalSuccess == 4) { possibleDialogue.Add(ResultCode.AIM_5); } else if (analysis.totalSuccess == 5) { possibleDialogue.Add(ResultCode.AIM_6); } else if (analysis.totalSuccess == 6) { possibleDialogue.Add(ResultCode.AIM_7); } else if (analysis.totalSuccess == 7) { possibleDialogue.Add(ResultCode.AIM_8); } else if (analysis.totalSuccess == 8) { possibleDialogue.Add(ResultCode.AIM_9); } return(null); }
private IEnumerator RhythmicSenseAct(List <GameResult> gameResults) { ResultAnalysis analysis = Analyze(gameResults); finalResult = chooseFinalResult(analysis.finalScore, Subject.RhythmicSense); generalAnalyze(gameResults); if (analysis.totalSuccess == 0) { possibleDialogue.Add(ResultCode.RHY_1); } else if (analysis.totalSuccess == 1) { possibleDialogue.Add(ResultCode.RHY_2); } else if (analysis.totalSuccess == 2) { possibleDialogue.Add(ResultCode.RHY_3); } else if (analysis.totalSuccess == 3) { possibleDialogue.Add(ResultCode.RHY_4); } else if (analysis.totalSuccess == 4) { possibleDialogue.Add(ResultCode.RHY_5); } else if (analysis.totalSuccess == 5) { possibleDialogue.Add(ResultCode.RHY_6); } else if (analysis.totalSuccess == 6) { possibleDialogue.Add(ResultCode.RHY_7); } else if (analysis.totalSuccess == 7) { possibleDialogue.Add(ResultCode.RHY_8); } else if (analysis.totalSuccess == 8) { possibleDialogue.Add(ResultCode.RHY_9); } return(null); }
/// <summary> /// Revisa si la sintaxis del escenario es correcta, recibe como parámetro las sentencias /// </summary> /// <returns></returns> public bool CheckSyntaxB(string xsentences) { if (xsentences.CompareTo(String.Empty) != 0) { sentences = xsentences; lexan = new LexicalAnalyzer(); //Analizador léxico nuevo synan = new SyntaxAnalyzer(lexan.createTableSymbol(sentences)); //Crear tabla de símbolo nueva ResultAnalysis ra = synan.checkSyntax(); if (ra.Error.Count == 0) { return(true); } return(false); } return(true); }
public async Task <ResultAnalysis> TextAnalysisAsync(string text) { ResultAnalysis model = null; try { model = new ResultAnalysis(); var level = await client.SentimentAsync(text); var key = await client.KeyPhrasesAsync(text); model.Score = (int)(level.Score * 10); model.Key = key.KeyPhrases; } catch (Exception ex) { CoreLogger.Instance.Error(this.CreateMessageLog(ex.Message)); } return(model); }
public DataSet getErrors(string sentence, string nameArena, string ids) { /*Guardar scenario*/ string process = "Initialize"; string type = "Poscondition"; LogicaNegocio log_neg = new LogicaNegocio(); log_neg.Ledeer().DefinitionLEDEER().addSentenceToScenario(nameArena, ids, sentence, process, type); DataSet ds = new DataSet(); try { ResultAnalysis rs = log_neg.Ledeer().AnalyzeLEDEER(sentence).CheckSyntax(); DataTable table = new DataTable(); table.Columns.Add("Code", System.Type.GetType("System.String")); table.Columns.Add("Description", System.Type.GetType("System.String")); table.Columns.Add("Line", System.Type.GetType("System.String")); table.Columns.Add("Symbol", System.Type.GetType("System.String")); ds.Tables.Add(table); foreach (Error er in rs.Error) { DataRow newRow = table.NewRow(); newRow["Code"] = er.Code; newRow["Description"] = er.Description; newRow["Line"] = er.Line.ToString(); newRow["Symbol"] = er.Symbol; table.Rows.Add(newRow); } } catch { ; } return(ds); }
/// <summary>Saves stored metrics from competition targets.</summary> /// <param name="competitionTargets">Competition targets with metrics to save.</param> /// <param name="annotationContext">The annotation context.</param> /// <param name="analysis">State of the analysis.</param> /// <returns>Saved targets, if any.</returns> protected override CompetitionTarget[] TrySaveAnnotationsCore(IReadOnlyCollection <CompetitionTarget> competitionTargets, AnnotationContext annotationContext, ResultAnalysis analysis) { var result = new List <CompetitionTarget>(); foreach (var targetToAnnotate in competitionTargets) { TrySaveAnnotationCore(targetToAnnotate, annotationContext, result, analysis); } return(result.ToArray()); }
/// <summary>Saves stored metrics from competition targets.</summary> /// <param name="competitionTargets">Competition targets with metrics to save.</param> /// <param name="annotationContext">The annotation context.</param> /// <param name="analysis">State of the analysis.</param> /// <returns> /// <c>true</c>, if metrics were saved successfully. /// </returns> protected override CompetitionTarget[] TrySaveAnnotationsCore( IReadOnlyCollection <CompetitionTarget> competitionTargets, AnnotationContext annotationContext, ResultAnalysis analysis) { var benchmarkType = analysis.RunState.BenchmarkType; var targetKey = new AnnotationTargetKey(benchmarkType.TypeHandle); var annotationFile = annotationContext.TryGetDocument(targetKey); if (annotationFile == null) { var origin = TryGetAnnotationLocation(analysis.Summary, analysis); if (origin == null) { annotationFile = annotationContext.GetUnknownOriginDocument(); } else { annotationFile = annotationContext.TryGetDocument(origin); if (annotationFile == null) { annotationFile = ParseAnnotationFile(benchmarkType, origin, analysis); annotationContext.AddDocument(annotationFile); } } annotationContext.AddTargetKey(annotationFile, targetKey); } if (!annotationFile.Parsed) { analysis.WriteSetupErrorMessage( $"Could not find XML annotation file {annotationFile.Origin} for the benchmark. Annotations were not saved."); return(Array <CompetitionTarget> .Empty); } var result = new List <CompetitionTarget>(); var xmlAnnotationFile = (XmlAnnotationFile)annotationFile; foreach (var targetToAnnotate in competitionTargets) { var target = targetToAnnotate.Target; var metrics = targetToAnnotate.MetricValues.Where(m => m.HasUnsavedChanges).ToArray(); if (metrics.Length == 0) { continue; } result.Add(targetToAnnotate); foreach (var metricValue in metrics) { analysis.Logger.WriteVerbose( $"Method {target.MethodDisplayInfo}: updating metric {metricValue.Metric} {metricValue}."); } } analysis.Logger.WriteVerboseHint( $"Annotating resource file '{annotationFile.Origin}'."); XmlAnnotationHelpers.AddOrUpdateXmlAnnotation( // ReSharper disable once AssignNullToNotNullAttribute xmlAnnotationFile.XmlAnnotationDoc, result, analysis.RunState.BenchmarkType, UseFullTypeName); foreach (var targetToAnnotate in competitionTargets) { var target = targetToAnnotate.Target; var metrics = targetToAnnotate.MetricValues.Where(m => m.HasUnsavedChanges).ToArray(); foreach (var metricValue in metrics) { analysis.Logger.WriteVerboseHint( $"Method {target.MethodDisplayInfo}: metric {metricValue.Metric} {metricValue} updated."); } } return(result.ToArray()); }
private IEnumerator ConcentrationAct(List <GameResult> gameResults) { ResultAnalysis analysis = Analyze(gameResults); finalResult = chooseFinalResult(analysis.finalScore, Subject.Concentration); generalAnalyze(gameResults); if (analysis.totalSuccess == 0) { possibleDialogue.Add(ResultCode.CON_1); } else if (analysis.totalSuccess == 1) { possibleDialogue.Add(ResultCode.CON_2); } else if (analysis.totalSuccess == 2) { possibleDialogue.Add(ResultCode.CON_3); } else if (analysis.totalSuccess == 3) { possibleDialogue.Add(ResultCode.CON_4); } else if (analysis.totalSuccess == 4) { possibleDialogue.Add(ResultCode.CON_5); } else if (analysis.totalSuccess == 5) { possibleDialogue.Add(ResultCode.CON_6); } else if (analysis.totalSuccess == 6) { possibleDialogue.Add(ResultCode.CON_7); } else if (analysis.totalSuccess == 7) { possibleDialogue.Add(ResultCode.CON_8); } else if (analysis.totalSuccess == 8) { possibleDialogue.Add(ResultCode.CON_9); } if (analysis.grList[analysis.grList.Count - 1].gameName.Equals("Cooking") && analysis.grList[analysis.grList.Count - 1].result == true) { possibleDialogue.Add(ResultCode.CON_12); } if (analysis.grList[analysis.grList.Count - 1].gameName.Equals("BoxingGame") && analysis.finalScore == 15) { possibleDialogue.Add(ResultCode.CON_13); } if (analysis.resultList[5] == false && analysis.resultList[6] == false && analysis.resultList[7] == false) { possibleDialogue.Add(ResultCode.CON_14); } return(null); }
static void Main(string[] args) { string[] notAllowed = { "a", "the", "and", "of", "in", "be", "also", "as" }; string text = System.IO.File.ReadAllText(Path.Combine(Environment.CurrentDirectory, "TextToAnalyse.txt")); Result result = new Result(); TextAnalizer analizer = new TextAnalizer(); analizer.WordsNotAnalyzed.AddRange(notAllowed); analizer.RawText = text; Console.WriteLine("Text to Analize:"); Console.WriteLine(text); Console.WriteLine(""); Console.WriteLine("Sentences:"); foreach (string sentence in analizer.Sentences) { //Write the sentence to analize Console.WriteLine(sentence); List <string> words = analizer.GetWordListFromSentence(sentence); foreach (string word in words) { ResultItem item = new ResultItem(); item.word = word; result.results.Add(item); } } ResultAnalysis.SortResults(result); ResultAnalysis.DeleteRepeatedResults(result); Result cleanList = new Result(); foreach (ResultItem item in result.results) { Console.WriteLine(@"Finding words of the same meaning... """ + item.word + @""""); List <string> buffer = ResultAnalysis.GetSameWord(item.word, result); if (buffer != null) { ResultItem newItem = new ResultItem(); newItem.word = item.word; newItem.total_occurrences = ResultAnalysis.GetTotalOccurrences(buffer, analizer.RawText); foreach (string sentence in analizer.Sentences) { newItem.sentence_indexes.AddRange(ResultAnalysis.GetSentenceIndexes(buffer, sentence)); } cleanList.results.Add(newItem); } } Console.WriteLine(""); Console.WriteLine("Result JSON:"); Console.WriteLine(""); Console.WriteLine(cleanList.ToJSONResolvit()); Console.WriteLine(""); Console.WriteLine("Press Any Key to Contnue..."); Console.ReadKey(); }
///<summary> ///Checar sintaxis ///</summary> public ResultAnalysis checkSyntax() //regresa un objeto de ResultAnalysis { ResultAnalysis ra = new ResultAnalysis(); List <Error> er1 = checkTable(); if (er1.Count == 0) //No exista error { //Análizar sintaxis de la tabla de símbolo //Crear errores para análisis sintáctico //bool iter = true; int index1 = 0; bool newline = false; bool error = false; while (index1 < table_symbol.Count) //Mientras existan tokens { Automata automata = new Automata(); //Crear automata por línea newline = false; error = false; int line = 0; if (Int32.TryParse(table_symbol[index1].Line, out line))//Obtener la línea en entero //Analizar línea { while (!error && !newline && index1 < table_symbol.Count) { if (automata.ValidateSentence(table_symbol[index1].Code, table_symbol[index1].Line) == -1) { //Si hay error ra.SetError(automata.CurrentState, Symbol.traslatorCode(automata.Sentence), line); //Crear un error error = true; } int nextline = this.getNumberLine(table_symbol, index1 + 1); if (nextline != line)//Si el siguiente token es otra línea sale del ciclo { newline = true; } if (error && index1 < table_symbol.Count) { //ir hasta la linea nueva index1 = getNexLineIndex(table_symbol, index1); } else { index1++; } } if (!error && !automata.ValidateAutomata())//Si al terminar la linea,el automata no queda en estado de acept. se establece error { ra.SetError(0, Symbol.traslatorCode(table_symbol[index1 - 1].Code), line); } } else { index1++; } } } else { ra.Error = er1; } return(ra); }
private ResultAnalysis Analyze(List <GameResult> gameResults) { ResultAnalysis output = new ResultAnalysis(); for (int i = 0; gameResults.Count > i; i++) { //게임별 GameAnalysis 생성 GameAnalysis temp = null; if (output.gaList.Exists(x => x.gameName.Equals(gameResults[i].name)))//이미 게임이 있음 { temp = output.gaList.Find(x => x.gameName.Equals(gameResults[i].name)); temp.frequency++; //성공 수 if (gameResults[i].resultValue != Result.Fail) { temp.success++; } } else// 없음 { temp = new GameAnalysis(gameResults[i].name, gameResults[i].resultValue); output.gaList.Add(temp); } //총 성공횟수 계산 & 성공 실패 순서 //각 게임별 Game_Result 생성 if (gameResults[i].resultValue != Result.Fail) { output.totalSuccess += 1; output.resultList.Add(true); output.grList.Add(new Game_Result(gameResults[i].name, true)); } else { output.resultList.Add(false); output.grList.Add(new Game_Result(gameResults[i].name, false)); } } //게임 별 연속 수 계산 for (int i = 0; output.gaList.Count > i; i++) { int highest = 0; int now = 0; for (int j = 0; gameResults.Count > j; j++) { if (output.gaList[i].gameName.Equals(gameResults[j].name)) { now++; } else { if (highest < now) { highest = now; now = 0; } } } if (highest < now) { highest = now; now = 0; } output.gaList[i].chain = highest; } output.finalScore = CalculateEndValue(5, gameResults); // 마지막 결과 계산 // 최종게임 결과 if (gameResults[numOfplay - 1].resultValue != Result.Fail) { output.finalGameResult = true; } return(output); }