Esempio n. 1
0
        public void LoadRSTInformation(RST.RSTDocument Document)
        {
            foreach (var graph in this.Graphs)
            {
                var tokens = Document.Tokens.Where(c => c.sentence == graph.name)
                             .OrderBy(c => c.sentencepos).ToList();

                //foreach (var token in tokens)
                //{
                //    var nodes = graph.Nodes.Where(c => c.nosuffix == token.lemma);
                //    if (nodes.Count() > 0)
                //    {
                //        foreach (var node in nodes)
                //        {
                //            if (node.rstweight < token.rstweight)
                //                node.rstweight = token.rstweight;
                //        }
                //    }
                //    else
                //    {

                //        Console.WriteLine("term " + token.lemma);
                //    }

                //}

                var defaultValue = tokens.OrderBy(c => c.rstweight).First().rstweight;
                foreach (var node in graph.Nodes)
                {
                    var token = tokens.Where(c => c.lemma == node.nosuffix)
                                .OrderByDescending(c => c.rstweight).FirstOrDefault();

                    if (token != null)
                    {
                        node.rstweight = token.rstweight;
                    }
                    else
                    {
                        //solo rst value a los elementos que contienen
                        //node.rstweight = defaultValue;
                    }
                }
            }
        }
Esempio n. 2
0
        public void SaveDocumentRST(RST.RSTDocument Document)
        {
            using (var client = this.CreateClient())
            {
                client.Connect();

                client.Cypher.Match("(d:Document)", "(r:RSTNode)")
                .Where((Common.Document d) => d.name == Document.name)
                .AndWhere((RSTNode r) => r.name == Document.root.name)
                .CreateUnique(string.Format("(d)-[:has]->(r)"))
                .ExecuteWithoutResults();

                client.Cypher.Create("(d:RSTNode {newObject})")
                .WithParam("newObject", Document.root)
                .ExecuteWithoutResults();

                this.SaveNodeRST(client, Document.root);
            }
        }