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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T05:28:10+00:00 2026-05-29T05:28:10+00:00

from the website http://nltk.googlecode.com/svn/trunk/doc/book/ch05.html i’ve come to know about splitting tagged words from a

  • 0

from the website http://nltk.googlecode.com/svn/trunk/doc/book/ch05.html i’ve come to know about splitting tagged words from a tagged corpus.

The code in the website:

>>> sent = '''
... The/AT grand/JJ jury/NN commented/VBD on/IN a/AT number/NN of/IN
... other/AP topics/NNS ,/, AMONG/IN them/PPO the/AT Atlanta/NP and/CC
... Fulton/NP-tl County/NN-tl purchasing/VBG departments/NNS which/WDT it/PPS
... said/VBD ``/`` ARE/BER well/QL operated/VBN and/CC follow/VB generally/RB
... accepted/VBN practices/NNS which/WDT inure/VB to/IN the/AT best/JJT
... interest/NN of/IN both/ABX governments/NNS ''/'' ./.
... '''
>>> [nltk.tag.str2tuple(t) for t in sent.split()]
  [('The', 'AT'), ('grand', 'JJ'), ('jury', 'NN'), ('commented', 'VBD'),
  ('on', 'IN'), ('a', 'AT'), ('number', 'NN'), ... ('.', '.')]

here i get a list of tagged words. What i want is a list containing only the words. For example:

  [('The'), ('grand'), ('jury')...

instead of

  ('The', 'AT'), ('grand', 'JJ'), ('jury', 'NN')...

Any suggestion how can i obtain this?

Thanks in advance.

  • 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-29T05:28:10+00:00Added an answer on May 29, 2026 at 5:28 am

    I’m not an nltk expert but you can directly pick the first tuple element with:

    [nltk.tag.str2tuple(t)[0] for t in sent.split()]
    

    That will give you a list of all the words:

    ['The', 'grand', 'jury'...
    

    What you’re asking is a little confusing, becuase in your output example every element is wrapped inside a 1-tuple, I don’t really see the point for that.

    Edit: Even though as larsman pointed out: ('The',) would be a 1-tuple, while ('The') == 'The'.

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

Sidebar

Related Questions

I was following instructions from a Java website ( http://java.sun.com/docs/books/tutorial/essential/io/file.html#createStream ) on creating or
Here's the C# code directly from the website ( http://jobijoy.blogspot.com/2007/10/time-picker-user-control.html ) that everyone refers
How do I get Firebug to do this: (from the Firebug website http://getfirebug.com/using.html )
I get a XML file from website ( http://www.abc.com/ ), URL is: http://www.abc.com/api/api.xml content
I'm using this example to fetch links from a website : http://www.merchantos.com/makebeta/php/scraping-links-with-php/ $xpath =
I was reading this tutorial from the DNN website http://www.dotnetnuke.com/Community/Blogs/tabid/825/EntryId/2675/DotNetNuke-Skinning-101-Part-2.aspx I found the tutorial
i am following the following steps from website: http://www.tatanka.com.br/ies4linux/page/Installation:Ubuntu but when i run the
I am using the code from this website (http://www.helloandroid.com/tutorials/using-threads-and-progressdialog) in my App. It is
I've tried using the download from the sencha website http://www.sencha.com/learn/Tutorial:Taking_Sencha_Touch_Apps_Offline when uploaded to my
I tried an example from this website: http://www.cs.cf.ac.uk/Dave/C/node24.html Sometimes, the output does not show

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.