public string GenerateMetadataNLG() { var temporal = new List <CGVerb>(); var noverbs = new List <string>() { }; var vers = this.Nodes.Where(c => !noverbs.Contains(c.nosuffix) && c.semanticroles.Contains("verb")).OrderByDescending(c => c.pagerank).ToList(); foreach (var verb in vers) { var cgverb = new CGVerb(verb); cgverb.GenerateVerbs(this); cgverb.GenerateAgents(this); cgverb.GeneratePatients(this); cgverb.GenerateThemes(this); cgverb.GenerateGoal(this); cgverb.GenerateAttribute(this); temporal.Add(cgverb); } var result = new List <CGVerb>(); foreach (var item in temporal.OrderByDescending(c => c.Rank)) { var count = result.Sum(c => c.Words); if (count > 100) { break; } result.Add(item); } return(JsonConvert.SerializeObject(result)); }
public string Summary() { StringBuilder sb = new StringBuilder(); var result = new List <CGVerb>(); var vers = this.Nodes.Where(c => c.semanticroles.Contains("verb")).OrderByDescending(c => c.pagerank).ToList(); foreach (var verb in vers) { var cgverb = new CGVerb(verb); cgverb.GenerateVerbs(this); cgverb.GenerateAgents(this); cgverb.GeneratePatients(this); cgverb.GenerateThemes(this); cgverb.GenerateGoal(this); cgverb.GenerateAttribute(this); result.Add(cgverb); } int words = 0; foreach (var item in result.OrderByDescending(c => c.Rank)) { words += item.Words; sb.AppendLine(item.SummaryLemme()); if (words > 100) { break; } } return(sb.ToString()); }