示例#1
0
        public override void SetConfig(Config config)
        {
            base.SetConfig(config);
            // dirs
            DirectoryInfo workDir = new DirectoryInfo(config.Get("work.dir", "work"));
            string        d       = config.Get("docs.dir", "trec");

            dataDir = new DirectoryInfo(Path.Combine(workDir.FullName, d));
            // files
            CollectFiles(dataDir, inputFiles);
            if (inputFiles.Count == 0)
            {
                throw new ArgumentException("No files in dataDir: " + dataDir);
            }
            // trec doc parser
            try
            {
                string trecDocParserClassName = config.Get("trec.doc.parser", "Lucene.Net.Benchmarks.ByTask.Feeds.TrecGov2Parser, Lucene.Net.Benchmark");
                trecDocParser = (TrecDocParser)Activator.CreateInstance(Type.GetType(trecDocParserClassName));
            }
            catch (Exception e) when(e.IsException())
            {
                // Should not get here. Throw runtime exception.
                throw RuntimeException.Create(e);
            }
            // html parser
            try
            {
                string htmlParserClassName = config.Get("html.parser",
                                                        "Lucene.Net.Benchmarks.ByTask.Feeds.DemoHTMLParser, Lucene.Net.Benchmark");
                htmlParser = (IHTMLParser)Activator.CreateInstance(Type.GetType(htmlParserClassName));
            }
            catch (Exception e)
            {
                // Should not get here. Throw runtime exception.
                throw RuntimeException.Create(e);
            }
            // encoding
            if (m_encoding == null)
            {
                m_encoding = Encoding.GetEncoding("iso-8859-1"); //StandardCharsets.ISO_8859_1.name();
            }
            // iteration exclusion in doc name
            excludeDocnameIteration = config.Get("content.source.excludeIteration", false);
        }
示例#2
0
 private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
 {
     nyaaParser = (IHTMLParser)comboBox1.SelectedItem;
 }