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

  • Home
  • SEARCH
  • 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 4569336
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T19:12:16+00:00 2026-05-21T19:12:16+00:00

I would like to calculate the frequency of function words in Python/NLTK. I see

  • 0

I would like to calculate the frequency of function words in Python/NLTK. I see two ways to go about it :

  • Use Part-Of-Speech tagger and sum up on POS tags which constitute to function words
  • Create a list of function words and perform a simple look up

The catch in the first case is that, my data is noisy and I don’t know(for sure) which POS tags constitute as function words. The catch in the second case is I don’t have a list and since my data is noisy the lookup won’t be accurate.

I would prefer the first to the second or any other example which would throw me more accurate results.

  • 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-21T19:12:17+00:00Added an answer on May 21, 2026 at 7:12 pm

    I just used the LIWC English 2007 dictionary ( I paid for the same) and performed a simple lookup as of now. Any other answers are most welcome.

    I must say I am a little surprised by the impulsiveness of a couple of answers here. Since, someone asked for code. Here’s what I did :

    ''' Returns frequency of function words '''
    def get_func_word_freq(words,funct_words):
        fdist = nltk.FreqDist([funct_word for funct_word in funct_words if funct_word in words]) 
        funct_freq = {}    
        for key,value in fdist.iteritems():
            funct_freq[key] = value
        return funct_freq
    
    ''' Read LIWC 2007 English dictionary and extract function words '''
    def load_liwc_funct():
        funct_words = set()
        data_file = open(liwc_dict_file, 'rb')
        lines = data_file.readlines()
        for line in lines:
            row = line.rstrip().split("\t")
            if '1' in row:
                if row[0][-1:] == '*' :
                    funct_words.add(row[0][:-1])
                else :
                    funct_words.add(row[0])
        return list(funct_words)
    

    Anyone who has done some code in python would tell you that performing a look up or extracting words with specific POS tags isn’t rocket science. To add, tags(on the question) of NLP(Natural Language Processing) and NLTK(Natural Language ToolKit) should be enough indication to the astute minded.

    Anyways, I understand & respect sentiments of people who reply here since most of it is free but I think the least we can do is show a bit of respect to question posters. As it’s rightly pointed out help is received when you help others, similarly respect is received when one respect’s others.

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

Sidebar

Related Questions

I'm playing around with 2 objects {@link http://docs.python.org/library/datetime.html#datetime.date } I would like to calculate
I have a series of datetime objects and would like to calculate the average
I would like to implement the method User.calculate_hashed_password . I'm trying to use the
I have a select statement with calculated columns and I would like to use
I would like to use a language that I am familiar with - Java,
I would like to filter an array of items by using the map() function.
I'm learning Clojure and would like some advice on idiomatic usage. As part of
I have a dataframe and would like to calculate the correlation (with Spearman, data
I would like to know if there is any query to calculate the count
I would like to remove/delete a migration file. How would I go about doing

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.