Create a function that creates a frequency distribution

Assignment Help Computer Engineering
Reference no: EM132211506

Assignment

Write a program using NLTK python that that contains the following (please use python 2.7)

Part 1

Given no parameters, create a function that returns a list of tuples where the first element in the tuple is a list of brown words for a given fileid and the second element is a category name.

Part 2

Given no parameters, create a function that creates a frequency distribution of brown words and returns a list of the top 1000 words.

Part 3

Given no parameters, create a function that returns a list containing the first file name from each brown category. Note: the built-in function returns a list file ids for a category. To select the first file name, you will need to use the following selection rule to extract the first file id.

[:1][0]

Part 4

Given a parameter containing a document, create a function that returns a dictionary of features. Note: you will not be able to test this function until more of the program is completed.

Part 5

Given a parameter containing a dictionary of features, create a function that returns an inverse dictionary of features.

Part 6

Given a parameter containing file name, first create a features dictionary using the function in Part 4. Second, create and inverse dictionary of the features dictionary using the function in Part 5. Finally return a list of True features for the file. Note: You must use the word True to extract the correct contents. Do not enclose the word in quotes or apostrophes. Capitalize as shown.

Part 7

Given a parameter containing a list of the first files from each brown category, create a function that returns a list of tuples with three elements. The first element is the category. The second element is the file name. The third element is a list of True features for a given file. Use the function from Part 6.

Part 8

Given a parameter containing a list of documents, create a function that returns a list of tuples containing a dictionary of features for the first element and a category name for the second element.

Part 9

Writing the main program

After you create the document list, remember to do a random shuffle

pprint the True features list.

After you create the featuresets, split the list into a training and testing list.

Create a classifier using a Naive Bayes Classifier.

Print the results from an accuracy test. Note: the result may change for each run due to the random shuffle.

Display the 10 most informative features. Note: the result may change for each run due to the random shuffle.

Reference no: EM132211506

Questions Cloud

Write a program with an array of four payroll objects : Design a PayRoll Class that has data members for an employee's hourly pay rate, number of hours worked,and total pay for the week.
Find optimal number of clusters using elbow method : Find optimal number of clusters using Elbow Method and then Apply K-Means clustering. Finally do visualization for K-Means Clustering.
Write a program of wordsearch puzzle : Write a program of wordSearch puzzle that use the following text file as an input. The output should be like this: PIXEL found (left) at (0,9).
Write a program using recursion : Write a program using recursion. The program asks the user to input an integer N and calculates and prints N!
Create a function that creates a frequency distribution : Given no parameters, create a function that creates a frequency distribution of brown words and returns a list of the top 1000 words.
Implementing erp in small and medium enterprises : ITECH5402- Enterprise Systems - Challenges and opportunities of implementing ERP in Small and Medium Enterprises (SMEs)
Write a program that takes 10 integer inputs from the user : Write a program that takes 10 integer inputs from the user via keyboard and puts them in one array called myNums[], then prints them back out.
Calculate the amount given to customer based on their total : Write a program using functions that calculate the amount given to a customer based on their total The program premps the to either an item choice.
Write a program that takes input of seven students : Write a program that takes input of Seven students and Should display the details of the seven students.

Reviews

Write a Review

Computer Engineering Questions & Answers

  Can statistical thesaurus generation be utilized to develop

question 1 will the clustering process always come to the same final set of clusters no matter what the starting

  Discuss your feelings about the use of affirmative action

Do you believe that affirmative action is justified or unjustified? Explain why you feel this way, and use specific examples to illustrate your point.

  Determine number of starting positions on the left side

Write a method startingPoints to determine number of starting positions on the left side of the grid that have a path connecting to the right side of the grid.

  Describe the role of data mining in the story

Using search engines and find two different 2018 newspaper articles involving data mining. Describe the role of "data mining" in the story using your own words.

  What type of exception would thrown if statement attempted

What type of exception would be thrown if a program statement attempted to access location 0 in an array defined to hold 20 elements?

  What is a requirement for live migration

What hardware assistance for virtualization can be provided by modern CPU s? What is a requirement for live migration?

  Describe the authentication methods that will be used

Describe the authentication methods that will be used, password policies, and how you will structure logins, users, and roles.

  Write down an application which prompts the user to enter a

write an application that prompts the user to enter a number to use as an array size and then attempt to declare an

  Problem on troubleshooting dns records

Problem on Troubleshooting DNS Records

  Implement a dynamic queue using car as an object

In a car assembly line, cars move on a belt from station to station in a queue. On each station, various components are attached to the cars.

  What is a preprocessor statement

Why is C so popular as a systems programming language in applications such as embedded microprocessor systems?

  How does dep prevent malicious attacks via buffer overflows

How does DEP prevent malicious attacks via buffer overflows? Is it always effective? Why might a user or administrator disable DEP?

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd