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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T12:49:48+00:00 2026-06-18T12:49:48+00:00

I am trying to learn how to tag spanish words using NLTK. From the

  • 0

I am trying to learn how to tag spanish words using NLTK.

From the nltk book, It is quite easy to tag english words using their example. Because I am new to nltk and all language processing, I am quite confused on how to proceeed.

I have downloaded the cess_esp corpus. Is there a way to specifiy a corpus in nltk.pos_tag. I looked at the pos_tag documentation and didn’t see anything that suggested I could. I feel like i’m missing some key concepts. Do I have to manually tag the words in my text agains the cess_esp corpus? (by manually I mean tokenize my sentance and run it agains the corpus) Or am I off the mark entirely. Thank you

  • 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-06-18T12:49:49+00:00Added an answer on June 18, 2026 at 12:49 pm

    First you need to read the tagged sentence from a corpus. NLTK provides a nice interface to no bother with different formats from the different corpora; you can simply import the corpus use the corpus object functions to access the data. See http://nltk.googlecode.com/svn/trunk/nltk_data/index.xml .

    Then you have to choose your choice of tagger and train the tagger. There are more fancy options but you can start with the N-gram taggers.

    Then you can use the tagger to tag the sentence you want. Here’s an example code:

    from nltk.corpus import cess_esp as cess
    from nltk import UnigramTagger as ut
    from nltk import BigramTagger as bt
    
    # Read the corpus into a list, 
    # each entry in the list is one sentence.
    cess_sents = cess.tagged_sents()
    
    # Train the unigram tagger
    uni_tag = ut(cess_sents)
    
    sentence = "Hola , esta foo bar ."
    
    # Tagger reads a list of tokens.
    uni_tag.tag(sentence.split(" "))
    
    # Split corpus into training and testing set.
    train = int(len(cess_sents)*90/100) # 90%
    
    # Train a bigram tagger with only training data.
    bi_tag = bt(cess_sents[:train])
    
    # Evaluates on testing data remaining 10%
    bi_tag.evaluate(cess_sents[train+1:])
    
    # Using the tagger.
    bi_tag.tag(sentence.split(" "))
    

    Training a tagger on a large corpus may take a significant time. Instead of training a tagger every time we need one, it is convenient to save a trained tagger in a file for later re-use.

    Please look at Storing Taggers section in http://nltk.googlecode.com/svn/trunk/doc/book/ch05.html

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

Sidebar

Related Questions

I'm trying to learn assembly using NASM, the pcasm-book.pdf from Dr Paul Carter -
I´m trying to learn C#, coming from a Python/PHP background, and I´m trying to
I am trying to learn MVC3 from Pro ASP.NET MVC3 Framework. But i am
I am trying to learn pickList from Primefaces . What I have jsf file,
I am following alloy-complex-form-examples from github trying to learn nested forms and I just
I'm trying to learn C++ and ran into this confusing example in the tutorial
I am trying to learn rails from zero programming experience and have an app
Please excuse my english, I'm still trying to master it. I've started to learn
well right now im trying to learn how to use the canvas tag on
I'm trying to learn to use xml in Java (Android platform, using Eclipse and

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.