예제 #1
0
 private void initComponents()
 {
     sentenceDetector = new EnglishMaximumEntropySentenceDetector(Path.Combine(ModelDir, "EnglishSD.nbin"));
     tokenizer        = new EnglishMaximumEntropyTokenizer(Path.Combine(ModelDir, "EnglishTok.nbin"));
     posTagger        = new EnglishMaximumEntropyPosTagger(Path.Combine(ModelDir, "EnglishPOS.nbin"));
     chunker          = new EnglishTreebankChunker(Path.Combine(ModelDir, "EnglishChunk.nbin"));
     parser           = new EnglishTreebankParser(FileUtils.WithSeparator(ModelDir), true, false);
 }
 public ParseBasedPhrasalVerbDetector(EnglishTreebankParser parser, Lemmatizer lemmatizer,
                                      EnglishMaximumEntropyTokenizer tokenizer, EnglishMaximumEntropyPosTagger tagger)
 {
     this.parser     = parser;
     this.lemmatizer = lemmatizer;
     this.tokenizer  = tokenizer;
     this.tagger     = tagger;
 }
예제 #3
0
        private Parse ParseSentence(string sentence)
        {
            if (_parser == null)
            {
                _parser = new EnglishTreebankParser(_modelPath, true, false);
            }

            return(_parser.DoParse(sentence));
        }
예제 #4
0
        public static OpenNLP.Tools.Parser.Parse ParseSentence(string sentence)
        {
            if (mParser == null)
            {
                mParser = new OpenNLP.Tools.Parser.EnglishTreebankParser(mModelPath, true, false);
            }

            return(mParser.DoParse(sentence));
        }
예제 #5
0
 private static EnglishTreebankParser GetParser()
 {
     if (_parser == null)
     {
         var modelPath = PathToApplication + "Resources/OpenNlp/Models/";
         _parser = new EnglishTreebankParser(modelPath, true, false);
     }
     return(_parser);
 }
예제 #6
0
        private string MySentenceStructure(string sentence)
        {
            var modelPath = Path.GetDirectoryName(Process.GetCurrentProcess().MainModule.FileName) + @"\Models\";

            var parser = new EnglishTreebankParser(modelPath);
            var parse  = parser.DoParse(sentence);
            var result = parse.Show();

            return(result);
        }
예제 #7
0
        private void ShowParse()
        {
            if (txtInput.Text.Length == 0)
            {
                return;
            }

            //prepare the UI
            txtInput.Enabled = false;
            btnParse.Enabled = false;
            this.Cursor      = Cursors.WaitCursor;

            lithiumControl.NewDiagram();

            //do the parsing
            if (mParser == null)
            {
                mParser = new EnglishTreebankParser(mModelPath, true, false);
            }
            mParse = mParser.DoParse(txtInput.Text);

            if (mParse.Type == MaximumEntropyParser.TopNode)
            {
                mParse = mParse.GetChildren()[0];
            }

            //display the parse result
            ShapeBase root = this.lithiumControl.Root;

            root.Text    = mParse.Type;
            root.Visible = true;

            AddChildNodes(root, mParse.GetChildren());
            root.Expand();

            this.lithiumControl.DrawTree();

            //restore the UI
            this.Cursor      = Cursors.Default;
            txtInput.Enabled = true;
            btnParse.Enabled = true;
        }
예제 #8
0
 public OpenNLPBridge()
 {
     _parser = new EnglishTreebankParser(ConfigurationManager.AppSettings["ModelsLocation"]);
 }
예제 #9
0
 public PosTagger()
 {
     nlpParser = new EnglishTreebankParser(nbinFilePath, true, false);
 }