Input:
A text file named "upper.txt" with the following content:THIS IS A SAMPLE TEXT FILE.ALL LETTERS ARE UPPERCASE.
Desired Output:
A new file named "lower.txt" with the following content:this is a sample text file.
all letters are lowercase.
Question 3: (3 marks)
Write a Python program that takes a document as input and outputs a list of the named entities (people, organizations, locations) in the document.
Hint: This requires using a named entity recognition library like spaCy.
Example:
Input:
A document: "Apple Inc. is an American multinational technology company. Its headquarters are in Cupertino, California."
Output:
[('Apple Inc.', 'ORG'), ('American', 'NORP'), ('Cupertino', 'GPE'),('California','GPE')]
Question 4: (3 marks)
Write a Python program that takes a sentence as input and outputs a new sentence where all the words are sorted alphabetically
+ 100%
Zoom
Close