示例#1
0
        public static void ConceptualSummaryDebug(string InputDir, string AmrDir, string OutputDir)
        {
            var files = Directory.GetFiles(InputDir, "*.txt");

            foreach (var file in files)
            {
                var amrfile = Path.Combine(AmrDir, Path.GetFileNameWithoutExtension(file) + ".txt.all.basic-abt-brown-verb.parsed");
                if (File.Exists(amrfile))
                {
                    var sanityAMR = SanityXml.Sanity(File.ReadAllText(amrfile));
                    var reader    = new AMR.AMRReader();
                    var amrdoc    = reader.ReadContent(sanityAMR);
                    amrdoc.LoadDummyRSTInformation();
                    CGGraph cgraph = new CGGraph(Path.GetFileNameWithoutExtension(file), @"D:\Tesis2016\Propbank\frames", amrdoc.Graphs.Sum(c => c.Nodes.Count));
                    cgraph.ReadAMR(amrdoc);
                    cgraph.Digest();


                    StringBuilder sb = new StringBuilder();
                    sb.AppendLine(File.ReadAllText(file));
                    sb.AppendLine("==================summary==========================");
                    sb.AppendLine(cgraph.Summary());
                    sb.AppendLine("==================debug==========================");
                    sb.AppendLine(cgraph.SummaryDebug());

                    File.WriteAllText(Path.Combine(OutputDir, Path.GetFileNameWithoutExtension(file) + ".txt"), sb.ToString());
                }
            }
            Console.ReadLine();
        }
示例#2
0
        //private static string ManualSummaryDir = @"D:\Tesis2016\Jarvis\Lincoln\LAB\ManualSummaries";
        //private static string InputDir = @"D:\Tesis2016\Jarvis\Lincoln\00Input\Input";
        //private static string SintacticDir = @"D:\Tesis2016\Jarvis\Lincoln\02SintacticAnalysis\Output\";
        //private static string RSTDir = @"D:\Tesis2016\Jarvis\Lincoln\03RST\Input\";
        //private static string RSTSanityDir = @"D:\Tesis2016\Jarvis\Lincoln\03RST\Sanity\";
        //private static string RSTSummaryDir = @"D:\Tesis2016\Jarvis\Lincoln\03RST\Summaries\";
        //private static string AMRDir = @"D:/Tesis2016/Jarvis/Lincoln/05AMRParsing/Output/";
        //private static string AMRSanityDir = @"D:/Tesis2016/Jarvis/Lincoln/05AMRParsing/Sanity/";
        //private static string ConceptualGraphDir = @"D:/Tesis2016/Jarvis/Lincoln/07ConceptualGraph/Summaries";
        //private static string ConceptualGraphNoRSTDir = @"D:/Tesis2016/Jarvis/Lincoln/07ConceptualGraph/SummariesNonRST";
        //private static string ConceptualLogGraphDir = @"D:/Tesis2016/Jarvis/Lincoln/07ConceptualGraph/Logs";
        //private static string ConceptualLogGraphNoRSTDir = @"D:/Tesis2016/Jarvis/Lincoln/07ConceptualGraph/LogsNoRst";


        public static void RSTSummary(string ManualSummaryDir, string RSTInputDir, string RSTSummaryDir)
        {
            var files = Directory.GetFiles(ManualSummaryDir, "*.txt");

            foreach (var file in files)
            {
                var rstfile = Path.Combine(RSTInputDir, Path.GetFileNameWithoutExtension(file) + ".txt.xml.jarvis");

                if (File.Exists(rstfile))
                {
                    var           sanity      = SanityXml.Sanity(File.ReadAllText(rstfile));
                    RST.RSTReader rstreader   = new RST.RSTReader();
                    var           rstdocument = rstreader.ReadDocumentContent(sanity, Path.GetFileNameWithoutExtension(file));
                    rstdocument.EvaluateODonell(false);
                    File.WriteAllText(Path.Combine(RSTSummaryDir, Path.GetFileNameWithoutExtension(file) + ".txt"), rstdocument.Summary());
                }
                else
                {
                    Console.WriteLine("not found" + file);
                }
                var manualsummary = Path.Combine(ManualSummaryDir, Path.GetFileNameWithoutExtension(file) + ".txt");
                if (!File.Exists(manualsummary))
                {
                    Console.WriteLine("manual summary not found" + manualsummary);
                }
            }
            Console.ReadLine();
        }
示例#3
0
        public static void ConceptualRSTNLG(string InputDir, string RSTDir, string AmrDir, string OutputDir)
        {
            var files = Directory.GetFiles(InputDir, "*.txt");

            foreach (var file in files)
            {
                var amrfile = Path.Combine(AmrDir, Path.GetFileNameWithoutExtension(file) + ".txt.all.basic-abt-brown-verb.parsed");
                if (File.Exists(amrfile))
                {
                    var sanity = SanityXml.Sanity(File.ReadAllText(Path.Combine(RSTDir, Path.GetFileNameWithoutExtension(file) + ".txt.xml.jarvis")));

                    RST.RSTReader rstreader   = new RST.RSTReader();
                    var           rstdocument = rstreader.ReadDocumentContent(sanity, Path.GetFileNameWithoutExtension(file));
                    rstdocument.EvaluateODonell(false);
                    var sanityAMR = SanityXml.Sanity(File.ReadAllText(amrfile));
                    var reader    = new AMR.AMRReader();
                    var amrdoc    = reader.ReadContent(sanityAMR);
                    amrdoc.LoadRSTInformation(rstdocument);
                    CGGraph cgraph = new CGGraph(Path.GetFileNameWithoutExtension(file), @"D:\Tesis2016\Propbank\frames", amrdoc.Graphs.Sum(c => c.Nodes.Count));
                    cgraph.ReadAMR(amrdoc);
                    cgraph.Digest();
                    File.WriteAllText(Path.Combine(OutputDir, Path.GetFileNameWithoutExtension(file) + ".txt"), cgraph.GenerateMetadataNLG());
                }
            }
            Console.ReadLine();
        }
示例#4
0
        public static void SaveRSTODonellGraph(string file)
        {
            if (File.Exists(file))
            {
                var           sanity      = SanityXml.Sanity(File.ReadAllText(file));
                RST.RSTReader rstreader   = new RST.RSTReader();
                var           rstdocument = rstreader.ReadDocumentContent(sanity, Path.GetFileNameWithoutExtension(file));
                rstdocument.EvaluateODonell(false);

                var str = rstdocument.SaveToBasicXML();

                File.WriteAllText(@"D:\Tesis2016\Jarvis\graphview\" + Path.GetFileNameWithoutExtension(file) + ".xml", str);
            }
        }