answer.
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
Crank
2 years ago
3

Jack just completed the program for the Flesch text analysis from this chapter’s case study. His supervisor, Jill, has discovere

d an error in his code. The error causes the program to count a syllable containing consecutive vowels as multiple syllables. Suggest a solution to this problem in Jack’s code and modify the program so that it handles these cases correctly.
An example text and the program input and output is shown below:
example.txt
Or to take arms against a sea of troubles, And by opposing end them? To die: to sleep.
Enter the file name: example.txt
The Flesch Index is 102.045
The Grade Level Equivalent is 1
3 sentences
18 words
21 syllables
"""
Program: textanalysis.py
Author: Ken
Computes and displays the Flesch Index and the Grade
Level Equivalent for the readability of a text file.
"""

# Take the inputs
fileName = input("Enter the file name: ")
inputFile = open(fileName, 'r')
text = inputFile.read()

# Count the sentences
sentences = text.count('.') + text.count('?') + \
text.count(':') + text.count(';') + \
text.count('!')

# Count the words
words = len(text.split())

# Count the syllables
syllables = 0
vowels = "aeiouAEIOU"
for word in text.split():
for vowel in vowels:
syllables += word.count(vowel)
for ending in ['es', 'ed', 'e']:
if word.endswith(ending):
syllables -= 1
if word.endswith('le'):
syllables += 1

# Compute the Flesch Index and Grade Level
index = 206.835 - 1.015 * (words / sentences) - \
84.6 * (syllables / words)
level = int(round(0.39 * (words / sentences) + 11.8 * \
(syllables / words) - 15.59))

# Output the results
print("The Flesch Index is", index)
print("The Grade Level Equivalent is", level)
print(sentences, "sentences")
print(words, "words")
print(syllables, "syllables")

The given code needs to be edited to be correct.

Computers and Technology
2 answers:
balandron [24]2 years ago
6 0

Answer:

Check the explanation

Explanation:

CODE;

# Take the inputs.

fileName = input("Enter the file name: ")

inputFile = open(fileName, 'r')

text = inputFile.read()

# Count the sentences

sentences = text.count('.') + text.count('?') + \

           text.count(':') + text.count(';') + \

           text.count('!')

# Count the words

words = len(text.split())

# Count the syllables

syllables = 0

vowels = 'aeiouAEIOU'

for word in text.split():

   if word[0] in vowels:

       syllables += 1

   for index in range(1, len(word)):

       if word[index] in vowels and word[index - 1] not in vowels:

           syllables += 1

   for ending in ['es', 'ed', 'e']:

       if word.endswith(ending):

           syllables -= 1

   if word.endswith('le'):

       syllables += 1

# Compute the Flesh index and grade level

index = 206.835 - 1.015 * (words / sentences) - \

       84.6 * (syllables / words)

level = int(round(0.39 * (words / sentences) + 11.8 * \

                 (syllables / words) - 15.59))

# Output the results

print("The Flesch Index is", index)

print("The Grade Level Equivalent is", level)

print(sentences, "sentences")

print(words, "words")

print(syllables, "syllables")

====================================================

Kindly check the attached image below for the code screenshot and output.

Mandarinka [93]2 years ago
4 0

Answer:

see explaination

Explanation:

# Take the inputs.

fileName = input("Enter the file name: ")

inputFile = open(fileName, 'r')

text = inputFile.read()

# Count the sentences

sentences = text.count('.') + text.count('?') + \

text.count(':') + text.count(';') + \

text.count('!')

# Count the words

words = len(text.split())

# Count the syllables

syllables = 0

vowels = 'aeiouAEIOU'

for word in text.split():

if word[0] in vowels:

syllables += 1

for index in range(1, len(word)):

if word[index] in vowels and word[index - 1] not in vowels:

syllables += 1

for ending in ['es', 'ed', 'e']:

if word.endswith(ending):

syllables -= 1

if word.endswith('le'):

syllables += 1

# Compute the Flesh index and grade level

index = 206.835 - 1.015 * (words / sentences) - \

84.6 * (syllables / words)

level = int(round(0.39 * (words / sentences) + 11.8 * \

(syllables / words) - 15.59))

You might be interested in
In cell M2, enter a formula using a nested IF function as follows to determine first if a student has already been elected to of
aleksley [76]

Answer:

Following are the code to this question:

code:

=IF(EXACT(I2,"Yes"),"Elected",IF(EXACT(K2,"Yes"),"Yes","No"))

Explanation:

In the given the data is not defined so we explain only  the above code, but before that, we briefly define working of if the function that can be defined as follows:

  • The If() function, is used only when one of the logical functions and its value must return the value true. or we can say it only return a true value.
  • In the above function, a column "Elected" is used that uses other column values to check this column value is equal if this condition is true it will return "yes" value.

8 0
2 years ago
Which are factors that go into a project plan? Choose four answers.
USPshnik [31]

Factors that go into a project plan

  • Estimate the scope of work, based on similar projects.
  • Make sure everyone takes responsibility.
  • Creating and defining team goal
  • Working to a budget

Explanation:

Project Estimating  : Every project is different, but that doesn’t mean you have to start from zero each time. The best way to make sure you’re on the right track is to approach it from every angle. Consider similar projects, talk to your team, and understand what the client is expecting and how they’d like things to go.

Managing your team size  : A smaller team is usually preferable as it puts your project in the most ideal position to be completed on time and at the quality you expect, without burning out your team members. A smaller team also reduces the number of communication channels, which means there’s less opportunity for misinterpretation or people simply missing something.  

Planning and managing your team resources  : That said, there may be a time when you don’t have the right resources in-house to do the job. Either they are fully allocated to another project or no one has the right skill set. In this situation you have two options, either bring in freelance contractors or hire a new employee to fill the role.  

Creating and defining team goals  : The planning phase is when you’ll want to work with the team to understand what their individual goals are for the project. Is there something different they’d like to try? A test or new idea they’d like the chance to prove? Or perhaps a roadblock they want to avoid?

Scheduling Tasks to a Project Timeline  : The timeline of the project will largely be determined by the client, as they often have deadlines they need to hit to meet certain business goals that are simply out of your control. However, setting clear expectations and agreeing on the timing of key deliverables is crucial.

7 0
2 years ago
You want to register the domain name ABCcompany.org, but the registration service is not allowing you to do that. What's the mos
Andreyy89

Options :

The domain name is registered to someone else.

Domain names must end in ".com".

You are not the legal owner of ABC Company.

Domain names must be all in lowercase.

Answer:

The domain name is registered to someone else.

Explanation: In the scenario above, ABCcompany.org represents the domain name of a particular person or establishment which provides access to the website of the owner. The domain name given to an individual or website must be distinct, that is no two different organizations or persons can use exactly the same domain name. Domain names can end with :. com, org, ng and various other and they aren't case sensitive. Therefore, the inability to register the domain name abive will likely stem from the fact that the domain name has is already registered to someone else.

6 0
2 years ago
Write a recursive, string-valued method, replace, that accepts a string and returns a new string consisting of the original stri
ch4aika [34]

Answer:

Check the explanation

Explanation:

public String replace(String sentence){

  if(sentence.isEmpty()) return sentence;

  if(sentence.charAt(0) == ' ')

     return '*' + replace(sentence.substring(1,sentence.length()));

  else

     return sentence.charAt(0) +            replace(sentence.substring(1,sentence.length()));

3 0
2 years ago
Which fact does lean green eco machines present to show that electric cars are not perfect
Yuri [45]

Answer: HOPE THIS HELPED YOU! :D ;)

Eco cars are still too expensive for most car buyers

Explanation:

5 0
2 years ago
Read 2 more answers
Other questions:
  • Characteristics of a LAN include _____. can be connected to the Internet covers the most area of all networks does not have to b
    5·1 answer
  • Consider the following relationship involving two entities, students and classes:A student can take many classes. A class can be
    9·1 answer
  • Write a program that replaces words in a sentence. The input begins with word replacement pairs (original and replacement). The
    11·1 answer
  • How does the discussion of “Luddites,” “Marx,” and “John Maynard Keynes” in paragraph 21 contribute to the development of the id
    7·1 answer
  • Given num_rows and num_cols, print a list of all seats in a theater. Rows are numbered, columns lettered, as in 1A or 3E. Print
    7·1 answer
  • Do Exercise 6.4 from your textbook using recursion and the is_divisible function from Section 6.4. Your program may assume that
    6·1 answer
  • Which bus slot provides highest video performance​
    10·1 answer
  • What answer best explains why improper netiquette is considered dangerous? Individuals who violate user policies are often charg
    14·2 answers
  • What are ways to enter a formula in Excel? Check all that apply. Click on the Function Library group and select a function from
    10·2 answers
  • An aviation tracking system maintains flight records for equipment and personnel. The system is a critical command and control s
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!