Questions
Python: Word Frequencies (Concordance) 1. Use a text editor to create a text file (ex: myPaper.txt)...

Python:

Word Frequencies (Concordance)

1. Use a text editor to create a text file (ex: myPaper.txt) It should contain at least 2 paragraphs with around 200 or more words.

2. Write a Python program (HW19.py) that

  • asks the user to provide the name of the text file. Be SURE to check that it exists!
    Do NOT hard-code the name of the file! Use the entry provided by the user!
  • read from the text file
  • NOTE: (write your program so that it ONLY works if it reads from the file specified by the user).

3. Your program will produce a dictionary of words with the number of times each occurs. It maps a word to the number of times the word occurs

  • Key: a word
  • Value: the number of times the word occurs in the text. The report should be an ALPHABETIZED output table, listing the word and the number of occurrences.

NOTES:

  • The input sequence can be words, numbers or any other immutable Python object, suitable for a dict key.
  • Ignore case – apple is the same as Apple is the same as APPLE, etc.
  • Discard all punctuation and extra white space (newlines, tabs, blanks, etc.).
  • Put the words into a dictionary. The first time a word is seen, the frequency is 1. Each time the word is seen again, increment the frequency. NOTE: you are REQUIRED to use the dictionary class for this assignment.
  • Produce a frequency table. To alphabetize the frequency table, extract just the keys and sort them. This sorted sequence of keys can be used to extract the counts from the dict.
  • Make sure that your output (the table) is formatted so that the columns are aligned, and so that there are titles for each column.
  • Be sure to modularize your code, using functions appropriately.
  • The main function should be clean and easy to read, calling the functions with meaningful names. Pass parameters – do not use global variables.

BONUS +5 pts:

  • Create a menu-driven front-end to this application.
    • First, populate the dictionary from the file
    • Next, provide a menu that allows the user to
      • Add words to the dictionary
                after asking the user for the word to add
                Note: the count should increase if the word is already there)
      • Check if a word is already in the dictionary
      • Delete a word from the dictionary after asking the user for the word to delete
      • Print the dictionary entries in table form as described above.
  • Allow the user to continue using the menu until they choose the option to quit.

In: Computer Science

Word Frequencies (Concordance)    1. Use a text editor to create a text file (ex: myPaper.txt)...

Word Frequencies (Concordance)   

1. Use a text editor to create a text file (ex: myPaper.txt) It should contain at least 2 paragraphs with around 200 or more words.

2. Write a Python program (HW19.py) that

  • asks the user to provide the name of the text file. Be SURE to check that it exists!
    Do NOT hard-code the name of the file! Use the entry provided by the user!
  • read from the text file
  • NOTE: (write your program so that it ONLY works if it reads from the file specified by the user).

3. Your program will produce a dictionary of words with the number of times each occurs. It maps a word to the number of times the word occurs

  • Key: a word
  • Value: the number of times the word occurs in the text. The report should be an ALPHABETIZED output table, listing the word and the number of occurrences.

NOTES:

  • The input sequence can be words, numbers or any other immutable Python object, suitable for a dict key.
  • Ignore case – apple is the same as Apple is the same as APPLE, etc.
  • Discard all punctuation and extra white space (newlines, tabs, blanks, etc.).
  • Put the words into a dictionary. The first time a word is seen, the frequency is 1. Each time the word is seen again, increment the frequency. NOTE: you are REQUIRED to use the dictionary class for this assignment.
  • Produce a frequency table. To alphabetize the frequency table, extract just the keys and sort them. This sorted sequence of keys can be used to extract the counts from the dict.
  • Make sure that your output (the table) is formatted so that the columns are aligned, and so that there are titles for each column.
  • Be sure to modularize your code, using functions appropriately.
  • The main function should be clean and easy to read, calling the functions with meaningful names. Pass parameters – do not use global variables.

BONUS +5 pts:

  • Create a menu-driven front-end to this application.
    • First, populate the dictionary from the file
    • Next, provide a menu that allows the user to
      • Add words to the dictionary
                after asking the user for the word to add
                Note: the count should increase if the word is already there)
      • Check if a word is already in the dictionary
      • Delete a word from the dictionary after asking the user for the word to delete
      • Print the dictionary entries in table form as described above.
  • Allow the user to continue using the menu until they choose the option to quit.

In: Computer Science

Python File program 5: Word Frequencies (Concordance)    20 pts 1. Use a text editor to create...

Python File

program 5: Word Frequencies (Concordance)    20 pts

1. Use a text editor to create a text file (ex: myPaper.txt) It should contain at least 2 paragraphs with around 200 or more words.

2. Write a Python program (HW19.py) that

  • asks the user to provide the name of the text file. Be SURE to check that it exists!
    Do NOT hard-code the name of the file! Use the entry provided by the user!
  • read from the text file
  • NOTE: (write your program so that it ONLY works if it reads from the file specified by the user).

3. Your program will produce a dictionary of words with the number of times each occurs. It maps a word to the number of times the word occurs

  • Key: a word
  • Value: the number of times the word occurs in the text. The report should be an ALPHABETIZED output table, listing the word and the number of occurrences.

NOTES:

  • The input sequence can be words, numbers or any other immutable Python object, suitable for a dict key.
  • Ignore case – apple is the same as Apple is the same as APPLE, etc.
  • Discard all punctuation and extra white space (newlines, tabs, blanks, etc.).
  • Put the words into a dictionary. The first time a word is seen, the frequency is 1. Each time the word is seen again, increment the frequency. NOTE: you are REQUIRED to use the dictionary class for this assignment.
  • Produce a frequency table. To alphabetize the frequency table, extract just the keys and sort them. This sorted sequence of keys can be used to extract the counts from the dict.
  • Make sure that your output (the table) is formatted so that the columns are aligned, and so that there are titles for each column.
  • Be sure to modularize your code, using functions appropriately.
  • The main function should be clean and easy to read, calling the functions with meaningful names. Pass parameters – do not use global variables.

BONUS +5 pts:

  • Create a menu-driven front-end to this application.
    • First, populate the dictionary from the file
    • Next, provide a menu that allows the user to
      • Add words to the dictionary
                after asking the user for the word to add
                Note: the count should increase if the word is already there)
      • Check if a word is already in the dictionary
      • Delete a word from the dictionary after asking the user for the word to delete
      • Print the dictionary entries in table form as described above.
  • Allow the user to continue using the menu until they choose the option to quit.

In: Computer Science

write an report essay on the topic "the growing urban youth unemployment" (MAX WORD 1260) requesting...

write an report essay on the topic "the growing urban youth unemployment"

(MAX WORD 1260)

requesting to be in word document

In: Economics

describe the role of osteoblast and osteoclast in your own word Describe layers pf epidermis in...

describe the role of osteoblast and osteoclast in your own word Describe layers pf epidermis in your own word

In: Anatomy and Physiology

Consider the phrase "confidence interval" - what does the word "confidence" imply and what is the...

Consider the phrase "confidence interval" - what does the word "confidence" imply and what is the information provided by the word "interval"?

In: Statistics and Probability

Consider the following code: lb $t0, 1($t1) sw $t0, 0($t2) Assume the followings. • The register...

Consider the following code:

lb $t0, 1($t1)

sw $t0, 0($t2)

Assume the followings.

• The register $t1 contains the content 0x1000,0000.

• The word at memory address 0x1000,0000 is 0xAABB,CCDD.

What value of the word is stored at the memory address pointed to by register $t2? Show the value of the word in hexadecimal.

In: Computer Science

For C++ Assume that word is a variable of type string that has been assigned a...

For C++

Assume that word is a variable of type string that has been assigned a value. Assume furthermore that this value always contains the letters "dr" followed by at least two other letters. For example: "undramatic", "dreck", "android", "no-drip".

Assume that there is another variable declared, drWord, also of type string. Write the statements needed so that the 4-character substring word of the value of word starting with "dr" is assigned to drWord. So, if the value of word were "George slew the dragon" your code would assign the value "drag" to drWord.

In: Computer Science

(1) Prompt the user for a string that contains two strings separated by a comma.

(In C)

(1) Prompt the user for a string that contains two strings separated by a comma. 

  • Examples of strings that can be accepted:

  • Jill, Allen

  • Jill , Allen

  • Jill,Allen

Ex:

Enter input string:
Jill, Allen


(2) Report an error if the input string does not contain a comma. Continue to prompt until a valid string is entered. Note: If the input contains a comma, then assume that the input also contains two strings. 

Ex:

Enter input string:
Jill Allen
Error: No comma in string.

Enter input string:
Jill, Allen


(3) Extract the two words from the input string and remove any spaces. Store the strings in two separate variables and output the strings. 

Ex:

Enter input string:
Jill, Allen
First word: Jill
Second word: Allen


(4) Using a loop, extend the program to handle multiple lines of input. Continue until the user enters q to quit. 

Ex:

Enter input string:
Jill, Allen
First word: Jill
Second word: Allen

Enter input string:
Golden , Monkey
First word: Golden
Second word: Monkey

Enter input string:
Washington,DC
First word: Washington
Second word: DC

Enter input string:
q

Code Given:

#include
#include

int main(void) {

/* Type your code here. */

return 0;
}

In: Computer Science

Clark 202 Part 1: Approximately how many bits are required to address a 4M x 16...

Clark 202

Part 1: Approximately how many bits are required to address a 4M x 16 main memory if:

a. Main memory is byte addressable?

b. or Main memory is word addressable?

Part 2: Consider 256 x 8 RAM chips for the following:

a. About how many are needed to provide a memory capacity of 4096 bytes?

b. How many lines must go to each and every chip?

Part 3: Digital computers have a memory unit with 24 bits per each word. The instruction set consists

of 150 different operations. All instructions have an operation code part (opcode) and

an address portion (allowing for only one address). Each instruction is stored in approximately one word

of memory.

a. How many bits are needed for the opcode?

b. How many bits are left for the address part of the instruction?

c. What is the approximate maximum allowable size for memory?

d. Please explain what is the largest unsigned binary number that can be accommodated in one word

of memory

Part 4: Assume a 230-byte memory.

a. What are the smallest and highest addresses if memory is byte addressable?

b. What are the smallest and highest addresses if memory is word addressable,

assuming a 16-bit word?

c. What are the lowest and highest addresses if memory is word addressable,

assuming a 32-bit word?

Let me know if you have any questions.

In: Computer Science