private static void ExtractKeyPhrases(CoreDocument coredoc, int id) { ArrayList sents = _analyzer.GetSents(coredoc); if (sents != null) { List <string> NP = new List <string>(); for (int i = 0; i < sents.size(); i++) { CoreMap sentence = (CoreMap)sents.get(i); List <Tree> smallTrees = NPExtractor.getKeyPhrases((Tree)sentence.get(typeof(TreeCoreAnnotations.TreeAnnotation))).ToList(); foreach (var tree in smallTrees) { List leaves = tree.getLeaves(); var objarray = leaves.toArray(); //foreach (var obj in objarray) //{ // NP.Add(obj.ToString()); //} string joinedNP = String.Join(" ", objarray); NP.Add(joinedNP); } } NounPhrases.Add(id, NP); } }
public static Dictionary <Project, double> LookingForProject(string Content, out HashSet <string> np) { np = NPExtractor.getNP(Content); string[] prefixes = { "find project about", "find project on", "find projects on", "find projects about" }; if (prefixes.Any(prefix => Content.ToLower().StartsWith(prefix))) { char[] delimiterChars = { ' ', ',', '.', ':', '\t', '?' }; var array = Content.ToLower().Split(delimiterChars); if (array.Length > 3) { for (int i = 3; i < array.Length; i++) { if (array[i] != "and" && array[i] != "or" && array[i].Length > 0) { np.Add(array[i]); } } } } if (np.Count > 0) { Dictionary <Project, double> project_list = QueryInterface.queryProject(np); return(project_list); } return(null); }
internal static HashSet <Tuple <Person, string> > LookingForTeam(string input) { HashSet <string> np = NPExtractor.getNP(input); if (np.Count > 0) { return(QueryInterface.queryTeam(np)); } return(null); }