exoMissingWords(ExercicesRow data) : base(data) { PhrasesRow sentence = (PhrasesRow)Phrases.Select("codePhrase = '" + data.codePhrase + "'")[0]; lblSentence.Text = sentence.traducPhrase; _solution = sentence.textePhrase; CreateChallenge(_solution, data.listeMots); }
exoPhraseDesordre(ExercicesRow data) : base(data) { PhrasesRow sentence = (PhrasesRow)Phrases.Select("codePhrase = '" + data.codePhrase + "'")[0]; lblSentence.Text = sentence.traducPhrase; flpSentence = new FlowLayoutPanel() { BackColor = Color.FromArgb(229, 229, 229), Width = flpChallenge.Width, //AutoSize = true }; flpSentence.ControlAdded += new ControlEventHandler(CallUpdateStatus); flpSentence.ControlRemoved += new ControlEventHandler(CallUpdateStatus); flpChallenge.Controls.Add(flpSentence); _solution = sentence.textePhrase; CreateChallenge(_solution); }
public XElement Serialize() { XElement elm = new XElement("pa", Elements.Select(e => new XAttribute(e.Key, e.Value)).Union(new[] { new XAttribute("b", Begin), new XAttribute("e", End), new XAttribute("a", AttributeString), new XAttribute("s", InternalID), //DO NOT use _speakerID, it is not equivalent }), Phrases.Select(p => p.Serialize()) ); if (_lang != null) { elm.Add(new XAttribute("l", Language.ToLower())); } return(elm); }
private static string GenerateText(Random random) { var sb = new StringBuilder("<p>Buongiorno.</p><p>"); for (int i = 0; i < 3; i++) { sb .Append(Phrases .Select(elem => elem[random.Next(elem.Count)]) .Aggregate((a, b) => $"{a} {b}")) .Append("<br/>"); } sb .Append("</p><p>Cordiali saluti.</p><br/><br/>") .Append("<p>Generated with ❤ by ") .Append("<a href=\"https://github.com/carlopantaleo/ColleaguesSpammer\">ColleaguesSpammer</a></p>"); return(sb.ToString()); }
private IEnumerable <PhraseIdWithRankModel> GetTopTen(string keyword) { var outp = new List <PhraseIdWithRankModel>(10); var i = 0; foreach (var phrase in Phrases.Select(x => new { x.Id, x.Value })) { var rank = StringMetrics.Levenstein(keyword, phrase.Value).Value; if (i < 10) { outp.Add(new PhraseIdWithRankModel { PhraseId = phrase.Id, Rank = rank }); i++; continue; } if (i == 10) { outp.Sort(new PhraseWithRankModelComparer()); } if (!(rank > outp[9].Rank)) { continue; } outp.RemoveAt(9); outp.Add(new PhraseIdWithRankModel { PhraseId = phrase.Id, Rank = rank }); outp.Sort(new PhraseWithRankModelComparer()); } return(outp); }