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 7582671
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T18:29:32+00:00 2026-05-30T18:29:32+00:00

Please find an example sentence: (S1 (S (S (NP (NP (NP (NN Activation)) (PP

  • 0

Please find an example sentence:

(S1 (S (S (NP (NP (NP (NN Activation)) (PP (IN of) (NP (NN protein) (NN kinase) (NN C)))) (CC and) (NP (NP (NN elevation)) (PP (IN of) (NP (NN cAMP))))) (VP (VBP interact) (ADVP (RB synergistically)) (S (VP (TO to) (VP (VB raise) (NP (NP (NP (NP (NN c-Fos)) (CC and) (NP (NN AP-1))) (NN activity)) (PP (IN in) (NP (NN Jurkat) (NNS cells))))))))) (. .)))

The objective is create a tree from this sentence; the leaves are the words, the intermediate nodes are the Part of speech tags, and the root is S1. The parenthesis indicate the span of the phrases contained within the sentence; they need not be included in the tree.

What would be a good combination of data-structures to achieve the above objective, and would you also be able to share the pseudo-code which supports your suggestion?

I have in mind a HashMap and ArrayList, but am confused how to actually begin with the implementation. Just that the logic isn’t coming intuitively to me at this point. Your suggestions would be appreciated.

Thanks.

  • 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-30T18:29:34+00:00Added an answer on May 30, 2026 at 6:29 pm

    I’ve done something similar in Python recently. I’ll address just the part about data structures:

    Each part of speech is either a list of parts of speech (a non-terminal), or just a single word (a terminal). So you could create classes something like:

    enum Type {
        Sentence,
        NounPhrase,
        VerbPhrase,
        Conjunction,
        ...
    };
    
    interface PartOfSpeech { };
    
    class NonTerminal implements PartOfSpeech {
        Type type;
        List<PartOfSpeech> subparts;
    };
    
    class Terminal implements PartOfSpeech {
        String word;
    };
    

    This is relatively untyped: your program needs to construct only valid strutures of these (e.g. no making a VerbPhrase consisting of a list of Sentences — you can do it but it’s meaningless!).

    The alternative route is to define a more explicit type system. So you could define classes for each type of part of speech, e.g.

    class VerbPhrase {
        Verb verb;
        AdverbPhrase adverb; /* optional */
        ...
    };
    

    Since there are several ways of making a verb phrase, you could instead have classes for each type:

    interface VerbPhrase { };
    
    class IntransitiveVerbPhrase implements VerbPhrase {
        Verb verb;
        AdverbPhrase adverb; /* optional */
    };
    
    class TransitiveVerbPhrase implements VerbPhrase {
        Verb verb;
        AdverbPhrase adverb; /* optional */
        NounPhrase obj;
    };
    

    And so on. The optimal degree of type explicitness at the Java level might not be obvious at the outset. Start by writing something that handles simple sentences, and see how it feels.

    In my case I created classes for each part of speech type, though each inherits from either a Terminal or Nonterminal. Then I have rules for how you can construct each type. This got kind of messy for some of them, e.g.

    add_rule(NounPhrase, [Noun])
    add_rule(NounPhrase, [RelativeNounWord])
    add_rule(NounPhrase, [Noun, AdjectiveClause])
    add_rule(NounPhrase, [Article, Noun])
    add_rule(NounPhrase, [Article, Adjectives, Noun])
    add_rule(NounPhrase, [Article, Noun, AdjectiveClause])
    add_rule(NounPhrase, [Article, Adjectives, Noun, AdjectiveClause])
    add_rule(NounPhrase, [Adjectives, Noun])
    add_rule(NounPhrase, [Adjectives, Noun, AdjectiveClause])
    add_rule(NounPhrase, [Article, Adjectives, Noun])
    ...
    

    That’s code for saying, “a NounPhrase is a Noun. Or, it’s a RelativeNoun. Or, it’s a Noun followed by an AdjectiveClause. Or, etc.”. There’s a general parser which attempts to apply rules to a list of words until it gets a tree. (You can see the messy and undocumented code at http://code.google.com/p/ejrh/source/browse/trunk/ircbot/nl.py .)

    There’s a certain amount of combinatorial explosion here. It could possibly be improved by introducing new types of parts of speech, or just making some parts of it as optional: intead of having a rule for every possible combination of Article/Adjectives/AdjectiveClause/etc. present/absent, you could just make them optional.

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

Sidebar

Related Questions

Can you please tell me where I can find example in how to invoke
Please find my example code below: String[] tempCrfFC = crfFC; //crfFC is a String[]
Please find the below code <?xml version=1.0 encoding=utf-8?> <mx:Application xmlns:mx=http://www.adobe.com/2006/mxml layout=absolute> <mx:Script> <![CDATA[ [Bindable]
Could you please help me find out the time complexity of the Fleury' algorithm
ereg and eregi functions will be deleted from Php. Please help to find alternatives
Please help me to find out error in my SQL query. I have created
Can somebody please explain how to find out if full text search is enabled
Could someone please point out a site where I can find an algorithm to
Could someone please explain? I couldn't find anything on the internet, everything talks about
I can't find the Html.Image method in new MVC RC version. Please somebody give

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.