Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 1109861
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T02:18:16+00:00 2026-05-17T02:18:16+00:00

I tried to parse a sentence using Stanford parser, but I get the exception.

  • 0

I tried to parse a sentence using Stanford parser, but I get the exception. The input file, code and exception are specified below.

I think the problem is because the penn tree in input file doesn’t handle punctuation. How do I generate a penn tree that handles punctuation too?

Input file

(ROOT
  (S
    (NP (DT A) (NN doctor) (NN investigation) (NN system) (NN (DIS)))
    (VP (VBZ is)
      (NP
        (NP (DT a) (NN part))
        (PP (IN of)
          (NP (DT a) (NN hospital) (NN information) (NN system) (NN (HIS).)))))))

code

            String str="-collapsed -treeFile temp.txt";
            String ar[]=str.split(" ");
            edu.stanford.nlp.trees.EnglishGrammaticalStructure.main(ar);

             try {
                FileOutputStream fw = new FileOutputStream("k.txt");
                PrintStream out = new PrintStream(fw);
                System.setOut(out);



            } catch (Exception e) {
                System.out.print(e);
            }

Exception raised :

Head is null: NN-37
Exception in thread "main" java.lang.IllegalArgumentException: governor or dependent cannot be null
        at edu.stanford.nlp.trees.UnnamedDependency.<init>(UnnamedDependency.java:105)
        at edu.stanford.nlp.trees.TreeGraphNode.dependencies(TreeGraphNode.java:519)
        at edu.stanford.nlp.trees.Tree.dependencies(Tree.java:1090)
        at edu.stanford.nlp.trees.GrammaticalStructure.<init>(GrammaticalStructure.java:71)
        at edu.stanford.nlp.trees.EnglishGrammaticalStructure.<init>(EnglishGrammaticalStructure.java:115)
        at edu.stanford.nlp.trees.EnglishGrammaticalStructure.<init>(EnglishGrammaticalStructure.java:89)
        at edu.stanford.nlp.trees.EnglishGrammaticalStructure.<init>(EnglishGrammaticalStructure.java:61)
        at edu.stanford.nlp.trees.EnglishGrammaticalStructure.<init>(EnglishGrammaticalStructure.java:53)
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-17T02:18:17+00:00Added an answer on May 17, 2026 at 2:18 am

    Unhelpful error message, but this is because the input tree is ill-formed: there is that stray period towards the end. The tree should be a well-formed s-expression.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I tried to parse a JSON file using PHP. But I am stuck now.
The code below tries to parse a file containing these 3 lines: 0 2
I think i don't get it. I tried to parse some html page :
I tried to parse a big JSON file using PHP and it always give
I tried to parse nature magazine's feed using php and several different rss/atom reader
I tried but i was unable to parse this json object which comes from
I'm using NSXMLParser to parse an rss feed. But I'm getting some strange behavior
I am trying to parse one XML file that contains some unicode characters.I tried
Possible Duplicate: Parse JSON with jQuery I tried to parse the following JSON File.
I got confused when I tried to parse following xml using libxmljs: <?xml version=1.0

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.