Write a Python program WSDpy that implements the Naive Bayes algorithm for word

Write a Python program WSD.py that implements the Naive Bayes algorithm for word sensedisambiguation, as discussed in class. Specifically, your program will have to assign a giventarget word with its correct sense in a number of test examples. You are not to use externallibraries such as pandas, scikit-learn, or NLTK.Please implement the Naive Bayes algorithm and cross-validation yourself, do notuse scikit-learn (or other machine learning library).You will train and test your program on a datase

Read More

Read both part Q4a Q4b and Q4c before attempting the question You can submit part Q4a

Read both part Q4(a), Q4(b), and Q4(c) before attempting the question. You can submit part Q4(a), Q4(b), and Q4(c) together. Question 4a Create and write a function countRepeatingChar(word: string): int, that returns the highest number of the "repeating letter" in the given parameter word. Assume the given parameter word is in lowercase. For example, countRepeatingChar(word) returns these values for the following words as parameters: - assistants 4 - that 2 - business 3 - count 1 Write a function initializeDictionary(filename: string): dictionary, that reads the words from the given filename and returns the dictionary in the following format: stats={4:[assistants],2:[that,function,repeating,letters],3:[repeated,suss,business,assist],1:[count,word]} The key is the number of the "repeating letters", and the value is a list of words. Content of the file will be words separated by space. Each line may contain one or more words (all in lowercase). Example of a sample input file content: For each of the word read, find the highest number of the "repeating letter" for this word. Use this number as the key to the dictionary, to either build the list or append the word into the list. (13 marks) Create and implement a main function that calls the initializeDictionary function, and write selected content of the dictionary into another file, in this order and format: - ignore words that have no repeating letter, i.e., those words with key = 1 - in ascending order of the number of "repeating letters", followed by the list of words that have this number of repeating letters Sample output file: 2: that function repeating letters 3: repeated suss business assist 4: assistants (9 marks)

Read both part Q4(a), Q4(b), and Q4(c) before attempting the question. You can submit part Q4(a), Q4(b), and Q4(c) together. Question 4a Create and write a function countRepeatingChar(word: string): int, that returns the highest number of the “repeating letter” in the given parameter word. Assume the given parameter word is in lowercase. For example, countRepeatingChar(word) returns these values for the following words as parameters: – assistants 4 – that 2 – business 3 – count 1 Write a functio

Read More

Objective read names from two different files into your program and write each name to a single new

Objective: Read names from two different files into your program and write each name to a single new file. Please make sure you download the namelist1.txt & namelist2.txt input files from the assignment page in Canvas and place them in the same folder as your program. - Input files: - nameslist1.txt & nameslist2.txt - Each file contains a list of 200 unique names. - Output file: - Output all names to an output file called allnames.txt Write a program that reads the names from the two input files and writes the names to the two output files: a. Ask the user to input the file name and path of the first input file. i. Use a try/except block to open all input before processing. ii. If the file cannot be opened, display the appropriate error message and require the user to reenter the file name and path. iii. Continue looping until the user has entered a valid file name and path. b. Ask the user to input the file name and path of the second input file. i. Use a try/except block to open all input before processing. ii. If the file cannot be opened, display the appropriate error message and require the user to reenter the file name and path. iii. Continue looping until the user has entered a valid file name and path. c. Ask the user to input the file name and path of the output file. i. Use a try/except block to open all input before processing. ii. If the file cannot be opened, display the appropriate error message and require the user to reenter the file name and path. iii. Continue looping until the user has entered a valid file name and path. d. Processing: i. Use a try/except block to read from the input files and write to the output file. ii. Read all the names from one input file at a time. Write the names to the output file. - You must use a while loop to process the first input file (nameslist1.txt) and write to the output file. - You must use a for loop to process the second input file (nameslist2.txt) and write to the output file. iii. Each line in each input file is one name. iv. Each name must be written on a separate line in the output file. v. There must be no blank lines between names in the output files. e. All input files and the output file must be closed after all names have been processed. Rubric: The rubric is located on the assignment page in Canvas. Please review the rubric to make sure you meet all of the requirements for this lab. Screen Shot: Enter the path and name of the first file: c:test Terr.txt Error: file(s) not found, or could not be opened Please reenter Enter the path and name of the first file: c:testnameslist1.txt Enter the path and name of the second file: c:testerr.txt Error: file(s) not found, or could not be opened Please reenter Enter the path and name of the second file: c:testnameslist2.txt Enter the path and name of the output file: c:testallnames.txt Names processing started Names processing complete

Objective: Read names from two different files into your program and write each name to a single new file. Please make sure you download the namelist1.txt & namelist2.txt input files from the assignment page in Canvas and place them in the same folder as your program. – Input files: – nameslist1.txt & nameslist2.txt – Each file contains a list of 200 unique names. – Output file: – Output all names to an output file called allnames.txt Write a program that reads the names from the two inp

Read More

Write a program that simulates a menu for a bakery called cakes It will contain the following

Write a program that simulates a menu for a bakery called "cakes". It will contain the following options: a. Register Product b. Delete Product c. Print Product Info d. Update Product e. Sell Product f. Exit Option a: Ask for the product key, name, price, and quantity. Save all info into an array with 5 elements. You will register ONE product at a time, then your program will return to the main menu. Duplicate product keys are not allowed. Validate your program so that it cannot register more than 5 products. Option b: Ask for the product key, then delete all info for that product. Option c: Ask for the product key, then print the product's name, price, quantity, and total number of sales (sales report). Option d: Ask for the product key, then present the following submenu: a. Update Product Name b. Update Product Price c. Update Product Quantity d. Exit Option e: Ask for the product key. Check if there is any product available. If available, input a quantity to sell, then update the "quantity" array. Option f: Exit. Validate your program so that it does not accept negative values for price, quantity, and sales. Your menus must be implemented using switch cases, must loop with do-while loops, and must handle invalid inputs.

Write a program that simulates a menu for a bakery called “cakes”. It will contain the following options: a. Register Product b. Delete Product c. Print Product Info d. Update Product e. Sell Product f. Exit Option a: Ask for the product key, name, price, and quantity. Save all info into an array with 5 elements. You will register ONE product at a time, then your program will return to the main menu. Duplicate product keys are not allowed. Validate your program so that it cannot register more t

Read More

Write a program that reads numbers from an array and graphs the information in the form of a bar

Write a program that reads numbers from an array and graphs the information in the form of a bar chart or histogram. If the number is printed, then a bar consisting of that many asterisks is printed beside the number. Note: The defined size of the array is 10. See the example below. 6. Write a program to determine the maximum height to which a projectile will travel if atmospheric resistance is neglected, for different initial velocities. This problem demonstrates the use of repetition controlled by a terminating limit. Method: The mass of the projectile is m, the initial velocity is v0 m/sec, and the last initial velocity is vfft/sec. From equations of motion: w=mg, Fz=maz. Applying these equations for the projectile results in the following equations: mg=mac gives ac = g. Initial conditions: s0 = 0, v0 = v. Final conditions: sf = h, vf = 0. From Kinematics: vf2 = v02 + 2ac(s - s0). 0 = v2 + 2ac(h - h0). 2ach = v2. h = 2acv2. Data: Real values of initial velocity at 50, 100, 150, and 200 ft/sec. The real value of gravitational acceleration is 32.2 ft/sec2.

Write a program that reads numbers from an array and graphs the information in the form of a bar chart or histogram. If the number is printed, then a bar consisting of that many asterisks is printed beside the number. Note: The defined size of the array is 10. See the example below. 6. Write a program to determine the maximum height to which a projectile will travel if atmospheric resistance is neglected, for different initial velocities. This problem demonstrates the use of repetition controlle

Read More

Activity 3 Write a Python program that will accept the number of minutes spent by a teenager over

Activity #3: Write a Python program that will accept the number of minutes spent by a teenager over the Internet, per day. Use the formula below and determine the addiction status by using the steps given. Hours spent on the Net = minutes spent on the Net / 60 If the hours spent on the Net are more than or equal to 2, display the message that "You might be addicted to the Net" and ask further questions: - Do you stay online longer than you intended? - Do you hear other people in your life complain about how much time you spend online? - Do you say or think, "Just a few more minutes" when online? - Do you try and fail to cut down on how much time you spend online? - Do you hide how long you've been online? If any 3 or more of the answers are 'yes', display to the user "You are an INTERNET ADDICT". If the user answered 'yes' less than 3, display "Control your Internet usage. You might become an ADDICT". For users who spent less than 2 hours, inform the user "Keep up the good habit".

Activity #3: Write a Python program that will accept the number of minutes spent by a teenager over the Internet, per day. Use the formula below and determine the addiction status by using the steps given. Hours spent on the Net = minutes spent on the Net / 60 If the hours spent on the Net are more than or equal to 2, display the message that “You might be addicted to the Net” and ask further questions: – Do you stay online longer than you intended? – Do you hear other people in your life compla

Read More

i Write a program in MATLABOctaveScilab or Python any other language please contact me that

i) Write a program in MATLAB/Octave/Scilab or Python (any other language, please contact me) that randomly generates a positive definite matrix. You cannot use any built-in function other than the one that generates the random numbers. ii) In order to check your previous code, write a function that implements Sylvester's criterion and use this function to check your code in i). Provide outputs of your code.

i) Write a program in MATLAB/Octave/Scilab or Python (any other language, please contact me) that randomly generates a positive definite matrix. You cannot use any built-in function other than the one that generates the random numbers. ii) In order to check your previous code, write a function that implements Sylvester’s criterion and use this function to check your code in i). Provide outputs of your code.

Read More