public EnglishTreebankParser(string dataDirectory, bool useTagDictionary, bool useCaseSensitiveTagDictionary, int beamSize, double advancePercentage)
        {
            SharpEntropy.IO.BinaryGisModelReader buildModelReader = new SharpEntropy.IO.BinaryGisModelReader(dataDirectory + "parser\\build.nbin");
            SharpEntropy.GisModel buildModel = new SharpEntropy.GisModel(buildModelReader);

            SharpEntropy.IO.BinaryGisModelReader checkModelReader = new SharpEntropy.IO.BinaryGisModelReader(dataDirectory + "parser\\check.nbin");
            SharpEntropy.IMaximumEntropyModel    checkModel       = new SharpEntropy.GisModel(checkModelReader);

            EnglishTreebankPosTagger posTagger;

            if (useTagDictionary)
            {
                posTagger = new EnglishTreebankPosTagger(dataDirectory + "parser\\tag.nbin", dataDirectory + "parser\\tagdict", useCaseSensitiveTagDictionary);
            }
            else
            {
                posTagger = new EnglishTreebankPosTagger(dataDirectory + "parser\\tag.nbin");
            }

            EnglishTreebankParserChunker chunker   = new EnglishTreebankParserChunker(dataDirectory + "parser\\chunk.nbin");
            EnglishHeadRules             headRules = new EnglishHeadRules(dataDirectory + "parser\\head_rules");

            mParser = new MaximumEntropyParser(buildModel, checkModel, posTagger, chunker, headRules, beamSize, advancePercentage);

            mTokenizer = new OpenNLP.Tools.Tokenize.EnglishMaximumEntropyTokenizer(dataDirectory + "EnglishTok.nbin");
        }
        public EnglishTreebankParser(string dataDirectory, bool useTagDictionary, bool useCaseSensitiveTagDictionary, int beamSize, double advancePercentage)
        {
            SharpEntropy.IO.BinaryGisModelReader buildModelReader = new SharpEntropy.IO.BinaryGisModelReader(dataDirectory + "parser\\build.nbin");
            SharpEntropy.GisModel buildModel = new SharpEntropy.GisModel(buildModelReader);

            SharpEntropy.IO.BinaryGisModelReader checkModelReader = new SharpEntropy.IO.BinaryGisModelReader(dataDirectory + "parser\\check.nbin");
            SharpEntropy.IMaximumEntropyModel checkModel = new SharpEntropy.GisModel(checkModelReader);

            EnglishTreebankPosTagger posTagger;

            if (useTagDictionary)
            {
                posTagger = new EnglishTreebankPosTagger(dataDirectory + "parser\\tag.nbin", dataDirectory + "parser\\tagdict", useCaseSensitiveTagDictionary);
            }
            else
            {
                posTagger = new EnglishTreebankPosTagger(dataDirectory + "parser\\tag.nbin");
            }

            EnglishTreebankParserChunker chunker = new EnglishTreebankParserChunker(dataDirectory + "parser\\chunk.nbin");
            EnglishHeadRules headRules = new EnglishHeadRules(dataDirectory + "parser\\head_rules");

            mParser = new MaximumEntropyParser(buildModel, checkModel, posTagger, chunker, headRules, beamSize, advancePercentage);

            mTokenizer = new OpenNLP.Tools.Tokenize.EnglishMaximumEntropyTokenizer(dataDirectory + "EnglishTok.nbin");
        }
Ejemplo n.º 3
0
        // Constructors ---------------------

        public EnglishTreebankParser(string dataDirectory, bool useTagDictionary, bool useCaseSensitiveTagDictionary, int beamSize, double advancePercentage)
        {
            var buildModelReader = new SharpEntropy.IO.BinaryGisModelReader(dataDirectory + Path.Combine("parser", "build.nbin"));
            var buildModel       = new SharpEntropy.GisModel(buildModelReader);

            var checkModelReader = new SharpEntropy.IO.BinaryGisModelReader(dataDirectory + Path.Combine("parser", "check.nbin"));

            SharpEntropy.IMaximumEntropyModel checkModel = new SharpEntropy.GisModel(checkModelReader);

            EnglishTreebankPosTagger posTagger = useTagDictionary ?
                                                 new EnglishTreebankPosTagger(dataDirectory + Path.Combine("parser", "tag.nbin"), dataDirectory + Path.Combine("parser", "tagdict"), useCaseSensitiveTagDictionary)
                : new EnglishTreebankPosTagger(dataDirectory + Path.Combine("parser", "tag.nbin"));

            var chunker   = new EnglishTreebankParserChunker(dataDirectory + Path.Combine("parser", "chunk.nbin"));
            var headRules = new EnglishHeadRules(dataDirectory + Path.Combine("parser", "head_rules"));

            _parser = new MaximumEntropyParser(buildModel, checkModel, posTagger, chunker, headRules, beamSize, advancePercentage);

            _tokenizer = new Tokenize.EnglishMaximumEntropyTokenizer(dataDirectory + "EnglishTok.nbin");
        }