Please Write-In Python Language (Topic: Word frequencies)
Method/Function: List<Token>
tokenize(TextFilePath)
Write a method/function that reads in a text file and returns a
list of the tokens in that file. For the purposes of this project,
a token is a sequence of alphanumeric characters, independent of
capitalization (so Apple, apple, aPpLe are the
same token). You are allowed to use regular expressions if you wish
to (and you can use some regexp engine, no need to write it from
scratch), but you are not allowed to import a tokenizer (e.g. from
NLTK), since you are being asked to write a tokenizer.
Method: Map<Token,Count>
computeWordFrequencies(List<Token>)
Write another method/function that counts the number of occurrences
of each token in the token list. Remember that you should write
this assignment yourself from scratch so you are not allowed to
import a counter when the assignment asks you to write that
method.
Method: void print(Frequencies<Token,
Count>)
Finally, write a method that prints out the word frequency count
onto the screen. The print out should be ordered by decreasing
frequency (so, the highest frequency words first).
Print the output in this format:
<token> -> <freq>
Please give me some notes about the codes, thanks!!!
In: Computer Science
Please use Python!
def getText(file):
This function should open the file named file, and return the contents of the file formatted as a single string. During processing, you should (i) remove any blank lines, (ii) remove any lines consisting entirely of CAPITALIZED WORDS , and (iii) replace any explicit ’\n’ (newline) characters with spaces unless directly preceeded by a ’-’ (hyphen), in which case you should simply remove both the hyphen and the newline, restoring the original word.
def getText(file):
pass
def flushMarks(text):
This function should take as input a string such as what might be returned by getText() and return a new string with the following modifications to the input:
Remove possessives, i.e., "’s" at the end of a word;
Remove ’)’, ’(’, ’,’, ’:’, ’-’, ’_’, ’...’, ’"’ and "’"; and Replace ’!’, ’?’ and ’;’ with ’.’
A condition of this function is that it should be easy to change or extend the substitutions made. In other words, a function that steps through each of these substitutions in an open-coded fashion will not get full credit; write your function so that the substitutions can be modified or extended without having to significantly alter the code. Here’s a hint: if your code for this function is more than a few lines long, you’re probably not doing it right.
# Specification: takes a string, text, and removes possessives ('s)
# and most punctuation ('(),:\'"- —_').
#
def flushMarks(text):
pass
In: Computer Science
| This assignment will be submitted to Turnitin®. | |
| Instructions | |
|
Instruction: Complete your essay in a new MS Word document and upload to iCollege. Your answer should demonstrate your ability to apply the concepts learned in our class. The word count of the text that includes your “own words” should be at least 500 words (about 700 max.). The text should be typed double-spaced using a 12-point font size in Times New Roman.
Suggested Answer: Students should discuss the advantages and disadvantages of division of labor. Someone specializing in the execution of a single operation might master it, but might be quite inadequate at others. Remember the famous Bruce Lee quote, “I fear not the man who has practiced 10,000 kicks once, but I fear the man who has practiced one kick 10,000 times.” Related concepts: Multiskilling, job rotation, job enrichment, assembly line. |
|
In: Economics
A solid cylinder
In: Physics
Let me know if the Adjusted trial balance on December 31, 20X6 is needed to answer the below as I can provide it. Thank you!
Questions 4 through 10 are based on the following December 31, 20X6 year-end account balances for XYZ Co. after adjusting entries had been prepared but before the books were closed for the year.
Cash……………..…………………………….250,000
Accounts receivable…………………….……..680,000
Marketable securities…………………………...60,000
Prepaid insurance……………………………….35,000
Prepaid rent….………………………………….30,000
Office equipment…………………………….....620,000
Accumulated depreciation: equipment………...200,000
Land……………………………………………750,000
Accounts payable………………………………306,000
Dividends payable……………………………… 50,000
Interest payable…………………………………... 8,750
Income tax payable……………………………...30,000
Unearned client service revenue………………..180,000
Notes payable (long-term).……………………..350,000
Common stock………………………………….750,000
Retained earnings….…………………………....315,200
Dividends…………………………………….......75,000
Client service revenue………………………...1,200,000
Travel expense………………………………..…..28,000
Office supplies expense…………………………..20,000
Advertising expense………………………………45,000
Salary expense…………………………………...400,000
Utility expense………………………………….....40,000
Depreciation expense: equipment…………………25,000
Interest expense……………………………….…...17,500
Insurance expense……………………………….....52,000
Rent expense……………………………………..175,000
Income tax expense………………………………..87,450
Using the data for question 4, prepare the income statement for the year ended December 31, 20X6. Attach your response in an excel or word file.
Using the data from Question 4, Prepare the statement of retained earnings for the year ended December 31, 20X6. Attach your response in an excel or word file.
Using the data in Question 4, Prepare the statement of financial position as of December 31, 20X6. Attach your response in an excel or word file.
Using the data in Question 4, Determine the working capital on December 31, 20X6.
| a. |
$350,756 |
|
| b. |
$480,250 |
|
| c. |
$580,520 |
|
| d. |
$574,750 |
Using data from Question 4, Determine the current ratio on December 31, 20X6.
| a. |
1.8356 |
|
| b. |
3.4781 |
|
| c. |
2.8749 |
|
| d. |
1.1355 |
Based on data from Question 4, Determine the acid-test (quick) ratio on December 31, 20X6.
| a. |
4.5586 |
|
| b. |
2.5000 |
|
| c. |
1.7225 |
|
| d. |
3.6752 |
In: Accounting
Leather Ltd has been in business for many years making hand-made, high end, leather goods. One of its products is a designer jacket. There are two divisions involved in the production of jackets, the Cutting Centre and the Stitching Division. Budgeted production for both divisions is 500 jackets per year. The Cutting Centre specialises in cutting out the unique designs and currently only supplies to the Stitching Division, which expertly hand stitches the product to make a jacket of exceptional quality. The Stitching Division then sells the product to exclusive clients for £3,500 per jacket. The Cutting Centre incurs variable costs of £1,800 per jacket and fixed overheads of £100,000. The Stitching Division incurs further variable processing costs of £900 per jacket and fixed overheads of £50,000.
Required: (b) Calculate the budgeted annual profit for each division and the company as a whole if the cut leather is transferred to the Stitching Division at transfer price of £2,000.
(c) Assuming divisional performance is measured based on profit, discuss and explain the likely reaction of the divisional managers to an imposed transfer price of £2,000. (maximum word count 100 words)
(d) It has now come to light that the Cutting Centre could sell 300 units of cut designs to an external customer for £3,000 per unit. Discuss the effect that this will have on Leather Ltd’s profits and the willingness of each divisional manager to accept an imposed transfer price of £2,000 in each of the following scenarios separately: Scenario 1: The Cutting Centre capacity is sufficient to supply both the external customer and the Stitching Division. Scenario 2: A restricted supply of skilled labour means that the Cutting Centre has a maximum production capacity of 500 units.
Use calculations to support your answer. (maximum word count 120 words)
(e) If the Cutting Centre’s demand from external customers grows until it reaches a point where it is working at maximum capacity supplying goods to external customers at £3,000 a unit, calculate and explain the minimum transfer price that the Cutting Centre would charge, assuming other costs remain the same. (maximum word count 60 words)
In: Accounting
Problem 1 - Find the Diphthongs
A diphthong is a composite vowel sound composed of two simple vowel sounds. We're going to be looking for these in words. For instance "ay" is normally a diphthong for instance in the words "lay" and "day", as is "ou" for instance in "loud," "lout."
We're going to simplify this by looking only for two vowels in a row in a word regardless of whether they are sounded out as diphthongs or not.
Let me show some examples of the counting:
[Ae]rat[io]n; count = 2
F[ou]ndat[io]n; count = 2
Q[ue][ue]ing; count = 2
The reason that we are counting this as two, is because once we've used a vowel as part of a diphthong do not use it again.
Note also that after the last pair, there's another vowel, but since the last e was used, the i doesn't pair, so it is not part of a diphthong.
P[ae]an; count = 1
Several; count = 0
[Ae][ae][ae][ae][ae]; count = 5
This is obviously an invented word, but who cares, it's composed of five diphthong pairs.
Glor[ia]; count = 1
For this exercise, the vowels are a, e, i, o, u, and y.
Take in a word, output each diphthong pair and finally output the count.
In terms of spaces, commas, and periods, let the words be divided, so don't count a dipthong over a space or other grammatical mark, meaning that for instance "a year" should group like "a [ye]ar" rather than "[a y][ea]r."
Sample Output
|
linux1[150]% python3 find_diphthongs.py Enter a string with a lot of diphthongs: aeration ae io The diphthong count is 2 linux1[151]% python3 find_diphthongs.py Enter a string with a lot of diphthongs: aeitiour ae io The diphthong count is 2 linux1[152]% python3 find_diphthongs.py Enter a string with a lot of diphthongs: ayayay ay ay ay The diphthong count is 3 linux1[153]% python3 find_diphthongs.py Enter a string with a lot of diphthongs: argument The diphthong count is 0 |
If you want to eliminate a space between your letters and you're printing the characters separately, use:
print('a', 'e', sep='')
In: Computer Science
DIRECTION: Create an NCP in relation to the case scenario.
Case Scenario: This is a case of a patient referred to a specialty memory clinic at the age of 62 with a 2-year history of repetitiveness, memory loss, and executive function loss. Magnetic resonance imaging scan at age 58 revealed mild generalized cortical atrophy. He is white with 2 years of postsecondary education. Retirement at age 57 from employment as a manager in telecommunications company was because family finances allowed and not because of cognitive challenges with work. Progressive cognitive decline was evident by the report of deficits in instrumental activities of daily living performance over the past 9 months before his initial consultation in the memory clinic. Word finding and literacy skills were noted to have deteriorated in the preceding 6 months according to his spouse. Examples of functional losses were being slower in processing and carrying out instructions, not knowing how to turn off the stove, and becoming unable to assist in boat docking which was the couple’s pastime. He stopped driving a motor vehicle about 6 months before his memory clinic consultation. His past medical history was relevant for hypercholesterolemia and vitamin D deficiency. He had no surgical history. He had no history of smoking, alcohol, or other drug misuse. Laboratory screening was normal. There was no first-degree family history of presenile dementia. Neurocognitive assessment at the first clinic visit revealed a poor verbal fluency (patient was able to produce only 5 animal names and 1 F-word in 1 min) as well as poor visuospatial and executive skills. He had fluent speech without semantic deficits. His neurological examination was pertinent for normal muscle tone and power, mild ideomotor apraxia on performing commands for motor tasks with no suggestion of cerebellar dysfunction, normal gait, no frontal release signs. His speech was fluent with obvious word finding difficulties but with no phonemic or semantic paraphrasic errors. His general physical examination was unremarkable without evidence of presenile cataracts. He had normal hearing. There was no evidence of depression or psychotic symptoms.
In: Nursing
Using python
what is needed to be added or changed
Problem 1:
The program has three functions in it.
I want you to complete the count_how_many_words() function, and then call it (multiple times) inside main() to find out how many times Poe used the word “Raven” (or “raven”) and how many times he used “Nevermore” (or “nevermore”) inside the poem “The Raven.” You may not use list.count().
Don’t add any global variables or constants (besides the one I’ve declared, which could be moved into main() but would be even uglier there).
Example output (with incorrect numbers):
The word "Raven" (or "raven") appears 42 times in Edgar Allen Poe's "The Raven."
The word "Nevermore" (or "nevermore") appears 48 times in Edgar Allen Poe's "The Raven."
# this is what quick-and-dirty data cleaning looks like, friends
def break_into_list_of_words(string):
"""takes a long string and returns a list of all of the words in the string"""
# vvv YOU DO NOT HAVE TO CHANGE ANYTHING IN HERE vvv
list_of_words = []
# break by newlines to get a list of lines
list_of_lines = string.split('\n')
# remove the empty lines
while '' in list_of_lines:
list_of_lines.remove('')
# split the line up
for line in list_of_lines:
# we have a few words run together with dashes
# this breaks the line up by dashes (non-ideal, but eh)
maybe_broken_line = line.split('—')
# now we will take the line that might be split, and we'll split again
# but this time on spaces
for a_line in maybe_broken_line:
list_of_words = list_of_words + a_line.split(' ')
# if blank spaces crept in (they did), let's get rid of them
while ' ' in list_of_words:
list_of_words.remove(' ')
while '' in list_of_words:
list_of_words.remove('')
# removing a lot of unnecessary punctuation; gives you more options
# for how to solve this problem
# (you'll get a cleaner way to do this, later in the semester, too)
for index in range(0, len(list_of_words)):
list_of_words[index] = list_of_words[index].strip(";")
list_of_words[index] = list_of_words[index].strip("?")
list_of_words[index] = list_of_words[index].strip(".")
list_of_words[index] = list_of_words[index].strip(",")
list_of_words[index] = list_of_words[index].strip("!")
# smart quotes will ruin your LIFE
list_of_words[index] = list_of_words[index].strip("“")
list_of_words[index] = list_of_words[index].strip("”")
list_of_words[index] = list_of_words[index].strip("’")
list_of_words[index] = list_of_words[index].strip("‘")
# all we have now is a list with words without punctuation
# (secretly, some words still have apostrophes and dashes in 'em)
# (but we don't care)
return list_of_words
# ^^^ YOU DO NOT HAVE TO CHANGE ANYTHING IN HERE ^^^
# this is the function you'll add a lot of logic to
def count_how_many_words(word_list, counting_string):
"""takes in a string and a list and returns the number of times that string occurs in the list"""
return None # this is just here so the program still compiles
def main():
count = 0
words = break_into_list_of_words(THE_RAVEN)
# a reasonable first step, to see what you've got:
# for word in words:
# print(word, end = " ")
if __name__ == "__main__":
main()
In: Computer Science
Item 1
In the case below, the original source material is given along with a sample of student work. Determine the type of plagiarism by clicking the appropriate radio button.
|
Original Source Material |
Student Version |
|
There is a design methodology called rapid prototyping, which has been used successfully in software engineering. Given similarities between software design and instructional design, we argue that rapid prototyping is a viable method for instructional design, especially for computer-based instruction. References: |
Tripp and Bichelmeyer (1990) suggested that rapid prototyping could be an advantageous methodology for developing innovative computer-based instruction. They noted that this approach has been used successfully in software engineering; hence, rapid prototyping could also be a viable method for instructional design due to many parallels between software design and instructional design.
|
Which of the following is true for the Student Version above?
Word-for-Word plagiarism
Paraphrasing plagiarism
This is not plagiarism
Hints
Item 2
In the case below, the original source material is given along with a sample of student work. Determine the type of plagiarism by clicking the appropriate radio button.
|
Original Source Material |
Student Version |
|
In examining the history of the visionary companies, we were struck by how often they made some of their best moves not by detailed strategic planning, but rather by experimentation, trial and error, opportunism, and--quite literally--accident. What looks in hindsight like a brilliant strategy was often the residual result of opportunistic experimentation and "purposeful accidents." References: |
When I look back on the decisions I've made, it's clear that I made some of my best choices not through a thorough analytical investigation of my options, but instead by trial and error and, often, simply by accident. The somewhat random aspect of my success or failure is, at the same time, both encouraging and scary. |
Which of the following is true for the Student Version above?
Word-for-Word plagiarism
Paraphrasing plagiarism
This is not plagiarism
Hints
Item 3
In the case below, the original source material is given along with a sample of student work. Determine the type of plagiarism by clicking the appropriate radio button.
|
Original Source Material |
Student Version |
|
Major changes within organizations are usually initiated by those who are in power. Such decision-makers sponsor the change and then appoint someone else - perhaps the director of training - to be responsible for implementing and managing change. Whether the appointed change agent is in training development or not, there is often the implicit assumption that training will "solve the problem." And, indeed, training may solve part of the problem.... The result is that potentially effective innovations suffer misuse, or even no use, in the hands of uncommitted users. References: |
When major changes are initiated in organizations, "... there is often the implicit assumption that training will 'solve the problem.' And, indeed, training may solve part of the problem." (Dormant, 1986, p. 238).
|
Which of the following is true for the Student Version above?
Word-for-Word plagiarism
Paraphrasing plagiarism
This is not plagiarism
Hints
Item 4
In the case below, the original source material is given along with a sample of student work. Determine the type of plagiarism by clicking the appropriate radio button.
|
Original Source Material |
Student Version |
|
Merck, in fact, epitomizes the ideological nature--the pragmatic idealism--of highly visionary companies. Our research showed that a fundamental element in the "ticking clock" of a visionary company is a core ideology--core values and a sense of purpose beyond just making money--that guides and inspires people throughout the organization and remains relatively fixed for long periods of time. References: |
While some have identified Merck as a visionary company dedicated to a "core values and a sense of purpose beyond just making money" (Collins & Porras, 2002, p. 48), others point out corporate misdeeds perpetrated by Merck (e.g., its role in establishing a dubious medical journal that republished articles favorable to Merck products) as contradictory evidence. References: |
Which of the following is true for the Student Version above?
Word-for-Word plagiarism
Paraphrasing plagiarism
This is not plagiarism
Hints
Item 5
In the case below, the original source material is given along with a sample of student work. Determine the type of plagiarism by clicking the appropriate radio button.
|
Original Source Material |
Student Version |
|
The philosophical position known as constructivismviews knowledge as a human construction. The various perspectives within constructivism are based on the premise that knowledge is not part of an objective, external reality that is separate from the individual. Instead, human knowledge, whether the bodies of content in public disciplines (such as mathematics or sociology) or knowledge of the individual learner, is a human construction. References: |
Does knowledge exist outside of, or separate from, the individual who knows? Constructivists argue that "... human knowledge, whether the bodies of content in public disciplines (such as mathematics or sociology) or knowledge of the individual learner, is a human construction." References: |
Which of the following is true for the Student Version above?
Word-for-Word plagiarism
Paraphrasing plagiarism
This is not plagiarism
Hints
Item 6
In the case below, the original source material is given along with a sample of student work. Determine the type of plagiarism by clicking the appropriate radio button.
|
Original Source Material |
Student Version |
|
When instructors are creating discussion board activities for online courses, at least two questions must be answered. First, what is the objective of the discussions? Different objectives might be to create a "social presence" among students so that they do not feel isolated, to ask questions regarding assignments or topics, or to determine if students understand a topic by having them analyze and evaluate contextual situations. Based on the response to this question, different rules might be implemented to focus on the quality of the interaction more so than the quantity. The second question is, how important is online discussions in comparison to the other activities that students will perform? This question alludes to the amount of participation that instructors expect from students in online discussions along with the other required activities for the course. If a small percentage of student effort is designated for class participation, our results show that it can affect the quality and quantity of interactions. References: |
According to Moore and Marra's (2005) case study, which observed two online courses, students in the first course implemented a constructive argumentation approach while students in second course had less structure for their postings. As they stated, when instructors create online discussion board activities, they must answer at least two questions. These questions are: "What is the objective of the discussions?" And "How important are online discussions in comparison to the other activities that students will perform?" According to their findings, the discussion activities that were designed based on the answers to these questions can influence the quality and quantity of interactions (Moore & Marra, 2005). References: |
Which of the following is true for the Student Version above?
Word-for-Word plagiarism
Paraphrasing plagiarism
This is not plagiarism
Hints
Item 7
In the case below, the original source material is given along with a sample of student work. Determine the type of plagiarism by clicking the appropriate radio button.
|
Original Source Material |
Student Version |
|
The philosophical position known as constructivismviews knowledge as a human construction. The various perspectives within constructivism are based on the premise that knowledge is not part of an objective, external reality that is separate from the individual. Instead, human knowledge, whether the bodies of content in public disciplines (such as mathematics or sociology) or knowledge of the individual learner; is a human construction. References: |
Constructivist philosophers assert that knowledge is made by humans themselves. Knowledge is not "out there" in some external reality separate from us. It is we humans who create the content in disciplines such as math and biology. That knowledge would not exist without people making it. References: |
Which of the following is true for the Student Version above?
Word-for-Word plagiarism
Paraphrasing plagiarism
This is not plagiarism
Hints
Item 8
In the case below, the original source material is given along with a sample of student work. Determine the type of plagiarism by clicking the appropriate radio button.
|
Original Source Material |
Student Version |
|
But what are reasonable outcomes of the influence of global processes on education?While the question of how global processes influence all aspects of education (and who controls these forces) is multidimensional and not completely testable, there appear to be some theories of globalization as it relates to education that can be empirically examined. References: |
Rutkowski and Rutkowski (2009) ask "what are reasonable outcomes of the influence of global processes on education?" (p. 138). This question is not entirely testable and has multiple dimensions but theories of globalization's impact on education exist and provide means of empirical analysis. References: |
Which of the following is true for the Student Version above?
Word-for-Word plagiarism
Paraphrasing plagiarism
This is not plagiarism
Hints
Item 9
In the case below, the original source material is given along with a sample of student work. Determine the type of plagiarism by clicking the appropriate radio button.
|
Original Source Material |
Student Version |
|
In a complex task such as creating a website for learning, instructors may want to support the generation of multiple solutions in learners' peer feedback. Anonymity may create a social context where learners feel freer to express varied ideas, and make the task of giving feedback less inhibited. However, teachers need to know just how anonymity impacts the learning dynamic in order to make informed choices about when anonymous configurations are appropriate in peer feedback. References: |
According to Howard, Barrett, and Frick (2010), in order to make appropriate choices educators must understand the ways in which hiding or showing the identity of participants can impact the interaction that takes place in peer feedback activities. Obscuring the identity of participants in peer feedback "may create a social context where learners feel freer to express varied ideas, and make the task of giving feedback less inhibited" (p. 90). References: |
Which of the following is true for the Student Version above?
Word-for-Word plagiarism
Paraphrasing plagiarism
This is not plagiarism
Hints
Item 10
In the case below, the original source material is given along with a sample of student work. Determine the type of plagiarism by clicking the appropriate radio button.
|
Original Source Material |
Student Version |
|
While solitary negative reactions or unjustified suggestions for change have the potential to dissipate discourse rather than build it, the pattern analysis shows that the anonymous condition seemed to provide a safe explorative space for learners to try out more reasons for their multiple solutions. Teachers will rarely give anonymous feedback, but the experience of giving anonymous feedback may open a social space where learners can try out the reasons for their suggestions. References: |
In their study of anonymity in an online peer feedback activity, the authors found that, under conditions of anonymity, learners seemed more inclined to provide reasons to back up their suggestions (Howard, Barrett, & Frick, 2010). Getting both suggestions and the reasons for the suggestions would be welcome in feedback I receive from peers or my instructors. Seeing the reasons would help me know that the suggestions have been thought through (even if I don't always agree with them). References: |
In: Operations Management