1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
DanielleElmas [232]
3 years ago
15

A common preprocessing step in many natural language processing tasks is text normalization, wherein words are converted to lowe

rcase, extraneous whitespace is removed, etc. Write a function normalize(text) that returns a normalized version of the input string, in which all words have been
converted to lowercase and are separated by a single space. No leading or trailing whitespace should be present in the output.

>>> normalize("This is an example.")
'this is an example.'
>>> normalize(" EXTRA SPACE ")
'extra space'
Computers and Technology
1 answer:
Arturiano [62]3 years ago
4 0

Answer:

def normalize(text):

   text = text.lower()

   text = text.split()

   return text

Explanation:

The functiinfunction is provided with an input text when called upon, then it changes every character in the text into lower case and split each word with a space.

You might be interested in
True or false A ClassB fire involves live electrical equipment
MAVERICK [17]
This is false. A Class B fire consists of highly combustible/flammable liquids and gases such as petroleum oil and propane.
4 0
3 years ago
Write a program that uses nested loops to collect data and calculate the average rainfall over a period of years. The program sh
babunello [35]

Answer:

In Python:

year = int(input("Years: "))

while year<1:

   year = int(input("Invalid. Enter 1 or greater: "))

total = 0

for i in range(1,year+1):

   for j in range(1,13):

       month = int(input("Year "+str(i)+", Month "+str(j)+": "))

       while month<0:

           month = int(input("Invalid. Enter 0 or greater: "))

       total+=month

ave = total/(12*year)

print("Months: "+str(12 * year))

print("Total: "+str(total))

print("Average: "+str(ave))

Explanation:

This gets the number of years

year = int(input("Years: "))

This loop validates the number of years

<em>while year<1:</em>

<em>    year = int(input("Invalid. Enter 1 or greater: "))</em>

<em />

This initializes total to 0

total = 0

This iterates through the years

for i in range(1,year+1):

This iterates through the month of each year

   for j in range(1,13):

This gets the rainfall for each month

       month = int(input("Year "+str(i)+", Month "+str(j)+": "))

This loop validates the amount of rainfall

<em>        while month<0:</em>

<em>            month = int(input("Invalid. Enter 0 or greater: "))</em>

This calculates the total rainfall

       total+=month

This calculates the average rainfall

ave = total/(12*year)

This prints the number of month

print("Months: "+str(12 * year))

This prints the calculated total amount of rainfall

print("Total: "+str(total))

This prints the calculated average amount of rainfall

print("Average: "+str(ave))

7 0
3 years ago
12. Fill in the blanks: In a ____________, the root of the tree is labeled _______________, children of the root are the names o
Alona [7]

Based on the description of the tree, the missing words are:

  • Binary tree.
  • Root node.
  • Internal nodes.
  • External node.
  • Structure.

<h3>What are the parts of a binary tree?</h3>

In a <u>Binary tree</u>, the roots are called the <u>root nodes</u> and the children of those roots are called the <u>internal nodes. </u>

The leaves are meant to designate the<u> external nodes</u>. These trees are helpful in evaluating architectural alternatives because they provide <u>structure.</u>

Find out more on binary trees at brainly.com/question/14990156.

6 0
2 years ago
Choose the response that best completes the following statement.
slava [35]

Answer:

consider the outcome

Explanation:

7 0
3 years ago
Define knowledge management
abruzzese [7]
Knowledge management is the process of creating, sharing, using and managing the knowledge and information of an organisation. It refers to a multidisciplinary approach to achieving organisational objectives by making the best use of knowledge.
4 0
3 years ago
Other questions:
  • Can anyone help me with edhesive 4.2 Question 1 ???
    11·2 answers
  • How is the numeric string that makes up a digital signature created?
    5·1 answer
  • A ____________ is a set of commands which can be run by calling it by name. (Phyton)
    7·2 answers
  • Java allows you to declare methods with the same name in a class. this is called
    10·1 answer
  • Write a MATLAB script that prompts the user to input the following array by providing an example in the prompt: [2 4;6 3;5 9]. C
    15·1 answer
  • Travel agents are market intermediaries who make their living by gathering, organizing, and dispensing information about travel-
    5·1 answer
  • Michelle has developed a new program for computers. She later fixed an error found in the program. What is the best way for her
    5·1 answer
  • Text and graphics that have been out of copied are stored in area called the _____
    15·2 answers
  • Which spreadsheet toolbar displays options such as Cut and Paste?
    11·2 answers
  • You work as a computer technician for a production company that travels all over the world while filming and editing music video
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!