Пример #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
        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();
        }