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

  Mathematics in computing

Binary search tree, and postorder and preorder traversal Determine the shortest path in Graph

  Ict governance

ICT is defined as the term of Information and communication technologies, it is diverse set of technical tools and resources used by the government agencies to communicate and produce, circulate, store, and manage all information.

  Implementation of memory management

Assignment covers the following eight topics and explore the implementation of memory management, processes and threads.

  Realize business and organizational data storage

Realize business and organizational data storage and fast access times are much more important than they have ever been. Compare and contrast magnetic tapes, magnetic disks, optical discs

  What is the protocol overhead

What are the advantages of using a compiled language over an interpreted one? Under what circumstances would you select to use an interpreted language?

  Implementation of memory management

Paper describes about memory management. How memory is used in executing programs and its critical support for applications.

  Define open and closed loop control systems

Define open and closed loop cotrol systems.Explain difference between time varying and time invariant control system wth suitable example.

  Prepare a proposal to deploy windows server

Prepare a proposal to deploy Windows Server onto an existing network based on the provided scenario.

  Security policy document project

Analyze security requirements and develop a security policy

  Write a procedure that produces independent stack objects

Write a procedure (make-stack) that produces independent stack objects, using a message-passing style, e.g.

  Define a suitable functional unit

Define a suitable functional unit for a comparative study between two different types of paint.

  Calculate yield to maturity and bond prices

Calculate yield to maturity (YTM) and bond prices

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