What you have learned about data structures and algorithms

Assignment Help Software Engineering
Reference no: EM133697712

Programming

Assignment Brief
This part of the assignment is an extension of part 1. Whereas for part 1 we considered the correctness only, we are concerned with the efficiency for this part.

The brief for Assignment Part 1 is copied below for your convenience:

In many situations, we may need to find a word based on one or more letters in it. For example, when making or completing a crossword you may want to find a word that has 4 letters, starts with J and ends with A. In this assignment, the program you will write will create a lexicon of words from various text files.

A word is a sequence of letters. Words will be treated in a case-insensitive manner. A simple option is to store all the words in lower case. Initially, a word is obtained as a sequence of characters separated by whitespace characters. Then numbers and punctuation characters, if any, must be removed. More specifically:

If the word "and" occurs twice in the file, it is only stored once in the lexicon.
If the word "you" also occurs as "YOU", only one version is stored.
Punctuation, such as commas, quotes, hyphens, full stops and question marks, are removed.
Numeric characters are removed.
If the word "don't" or the word "second-hand" appears in the input texts, they will be stored without punctuation (i.e. "dont" and "secondhand" respectively).
The 'word' "1", for example, will be ignored as it contains all numeric characters.
For each word, we also keep the following information:

The frequency: How many times the word appears in the input files.
The list of neighbours: A neighbour of a word w is a word that is of the same length and differs from w by only one letter. For example, if the word w refers to "cat", then:
"cathy" is not w's neighbour, for they are not of the same length.
"man" is not w's neighbour, for they differ by more than one letter.
"can" is a neighbour of w
"fat" is a neighbour of w
"cot" is a neighbour of w.
In this part of the assignment, you will need to:

Read one text file and construct a lexicon that contains words from the file

Write the words (including spellings, frequencies and neighbours) from the lexicon to a text file

The format of the text file MUST be the same as in Part 1 of the assignment

You should only include one solution. It is entirely up to you which data structure(s) and/or sorting algorithm(s) will be used, as long as they are included in the subject; however, you must take the program's efficiency in consideration, as the test file is much larger in this part.
The steps required to complete this part of the assignment should be similar to what you did in part 1
To simplify the structure of this notebook, sections have been created for you to populate with parts of your solution. With that said, you are more than welcome to create any additional code blocks as you see fit, just make sure it is clear how it is relevant to your final solution. As you create your solution, make sure you test it as you go to ensure all components work.

Once you have completed this assignment, you will also need to write a brief report describing the data structures and/or sorting algorithms you selected.

Instructions
In this task you to write a function, build_lexicon(), that has two parameters, an input_filename and output_filename.

This function should:

Read all words from the file described by input_filename, constructing a lexicon with all words
Write all words, including spellings, frequencies and neighbours from the lexicon to the file described by output_filename.
This functionality should exactly match what was required in part 1 of the assignment. That is, when writing words to the text file,

The words must be written in sorted alphabetical order.
The information on each word, which is also written to the text file, includes the frequency and the list of its neighbours.
The list of neighbours must also be in alphabetical order.
Neighbours in the list of neighbours can either be written with or without quotation marks around them (refer to part 1 of the assignment).
To output each word, first the spelling of the word is displayed, followed by the frequency, and then followed by the word's neighbours (in alphabetical order, inside a pair of square brackets).

Use the provided sample files to check if the output of your program is correct.

You may implement as many additional functions, etc. as you see fit to implement this task (e.g. similar to part 1 of the assignment where you had functions to read the data, write the data, etc.).

We have provided code that will call your function and create an output text file. Calling your function in this way is how we will test if your solution works as expected. You may not modify this function call.

Purpose/Rationale
The purpose of this assignment is to get practice implementing an efficient solution to a task using data structures and algorithms that you have learned in the subject so far. This is an extension of Part 1 of the assignment.

Task Details
This assignment focusses on content relating to algorithms and data structures you have covered in this subject so far. You are expected to use what you have learned about data structures and algorithms to solve this assignment. In addition, it is expected that you have prior Python programming knowledge to successfully complete this assignment.

Instructions

This assignment takes the form of a notebook, much like those which you have already encountered during your lab sessions. You are required to read through the tasks in the notebook and place your solutions in the code cells as instructed in the notebook itself. In addition to the notebook. you are also required to submit a report that addresses some questions as detailed in the notebook.

Reference no: EM133697712

Questions Cloud

Identify factors that increase vulnerability of child : Identify factors that increase the vulnerability of a child. Utilize the nursing process in completing a comprehensive health history.
Explain the social implications of using biological science : Explain the social implications of using biological science theories in public health interventions. What are the pros and cons?
Explain what is meant by quality and safety in healthcare : Explain what is meant by quality and safety in healthcare in Australia, and the other country and Explain similarities and/or differences in the other country
How does foreign military training lead to norm transmission : According to Scharpf, is there any risk involved in foreign military training? If training is risky, why do it? Also, why do governments train military abroad?
What you have learned about data structures and algorithms : CSE2ALG Programming, La Trobe University - You are expected to use what you have learned about data structures and algorithms to solve this assignment
What happens if i forget an appointment : What happens if I forget an appointment? Is what I tell you confidential? What if I have an emergency? How will I know when our work is finished? 7) Wh
Prepare your referral summary for one service you think : HSV 340- After writing the case note, prepare your referral summary for one service you think would be beneficial to Greg.
Example of which critique of pacifism : In which one country fights another to protect those unable to defend themselves is an example of which critique of pacifism?
What obstacles may exist related to gaps in languages : How might this country resist emergency response assistance from the U.S.? What obstacles may exist related to gaps in languages?

Reviews

Write a Review

Software Engineering Questions & Answers

  How is each type of association depicted on a class diagram

Give two examples of aggregation associations and generalization associations. How is each type of association depicted on a class diagram?

  Review the it online training specification description

Review the IT Online Training Specification description - Develop an application class model that includes entity classes, user interface classes, boundary, and controller classes. Review the use cases to make certain that the application class mod..

  Explain how businesses apply cryptography in maintaining

Explain how businesses apply cryptography in maintaining information security

  Select a u s company with global operations write a 3 page

select a u. s. company with global operations. write a 3 page paper in which you will respond to the following1.discuss

  Describe two tools to assist with the software development

Describe at least two tools to assist with the software development and security life cycles and discuss the pros and cons of each tool.

  Compare the plan-driven approach to software development

Compare the plan-driven approach to software development to the process of building a house. a. How are they similar? b. How are they different

  Draw flowchart to compute the sum of series

Draw a flowchart to calculate the sum of 3+6+9+....+36. Then code the problem using C++programming language. Draw a flowchart to print 3,6,9,....36 Then code the logic using C++ programming language

  Explain what is meant by a monad in a programming language

Explain what is meant by a monad in a programming language, giving the two fundamental operations of a monad along with their types.

  Design state transition diagram for member state

Design a state transition diagram which explains typical member state and how they change based on specific actions and events.

  Indicating whether the person has low income

The function should return the billing amount. Your program may prompt the user to enter the consulting time in minutes.

  Question about programming languages

Various contemporary languages permit two kinds of comments, one in which delimiters are used on both ends, and one in which delimiter marks only the starting of the comment, Discuss the advantages and disadvantages of each.

  Prepare an implementation plan that includes the processes

You are tasked with the job of preparing an implementation plan that includes the processes and procedures needed for a successful implementation.

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