Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 36 additions & 0 deletions Final Project Proposal
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
Proposal of Final Project Sheqi

My plan is to write a program that can calculate the frequency of the words appearing in a document.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This sounds like a great idea! Just to make sure, what functions do you think you would need to write in this program?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, how would you use structures or enumerated lists?


I want to do this because I think it's useful, and I believe the most important characteristic of computer programming is useful. In addition, I can almost handle it with the things I have learend in the summer program.

Steps:
1. Open document 1 and read it, and judge if it opens successfully at the same time.
2. If open successfully, as well as not reaching the end of the document, then calculate the frequency of a word.
3. Repeat step 2 till the end of the document.
4. Close document 1.
5. Open document 2 and try to record data on it, and judge if it opens successfully at the same time.
6. If open successfully, then record all the words and their frequencies in this document.
7. Close document 2.
8. Make all words fit in a static order (maybe from "a" to "z").
9. Open document 3 and try to record data in it, and judge if it opens successfully at the same time.
10. If open successfully, then record all the words and frequencies in the order in document 3.
11. Close document 3.

How to use loops:
During the process calculating the frequency of one word.
How to use advanced datatypes:
Use structures to combine the words and their frequencies together.
How to use functions:
....
How to use arrays:
In the process of calculating the frequency of one word.
Arrays:
In the structure.

External Library:
stdio.h
string.h
assert.h
ctype.h
math.h (maybe)
12 changes: 12 additions & 0 deletions Instruction about how to run it
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
Instruction of running my final project.

The main purpose of my code is to calculate the frequency of words appearing in a document the user selected, and print these frequencies into another file the user selected. Finally, sort the frequency with the descending order, and print them into the third file the user selected.

Here is the instruction:
1. When you see "Type in the name of the file:", please type in the name of a file that you want to calculate the words and their frequencies. You can type anything you like in the file, whatever a word, a sentence, a report, or a news. As soon as you finished type the name of the file, please push "enter" botton.
2. When you see "Input the unsorted file names for writing:", please enter the name of the file that you want to save all your datas about the word frequency without ordering in. This file must exist before you type in its name. It's better to have an empty file. As soon as you finished typing the name of the unsorting file, please push "enter" botton.
3. When you see "Input the sorted file names for writing:", please enter the name of the file that you want to save all you sorted datas about the word frequency. This file must exist before you type in its name. It's better to have an empty file. As soon as you finished typing the name of the soring file, please push "enter" botton.
4.After these three steps, the program stop running. At this time, you can go back to your unsorting file and sorting file, and the result will just lie in these two files.

IMPORTANT REMINDER:
Since I have just set the program for 5000 words at max, if you are going to run the program with files that have far more than 5000 kinds of words, please go to my code, and reset a range to make sure that the program will run.
23 changes: 23 additions & 0 deletions exampleNews.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
On the grounds of the Old State Capitol here, where nearly 160 years ago, Abraham Lincoln held forth on “a house divided,” Hillary Clinton on Wednesday lamented the Party of Lincoln’s transition to the Party of Trump, casting the present moment as an indelible stain on Republican history.

Yet even as she savaged Donald J. Trump as an existential threat to American democracy, a week before Republicans plan to nominate him for president in Cleveland, Mrs. Clinton set off on a delicate balancing act of her own.

She waded with care into the thickets of national reckonings over police violence and violence against the police, hoping to position herself as an unlikely agent of harmony.

And in an uncharacteristic admission, Mrs. Clinton assumed responsibility for at least a small measure of the fractiousness in the national discourse.

“I cannot stand here and claim that my words and actions haven’t sometimes fueled the partisanship that often stands in the way of our progress,” she told a small audience that crowded beneath a grand ceiling here. “So I recognize I have to do better, too.”

Though Mrs. Clinton has for weeks stressed unity as the binding theme of her campaign — making speeches in front of “Stronger Together” signs — the staging on Wednesday was particularly unsubtle.

She immediately invoked President Lincoln, quoting from his speech on June 16, 1858.

She spoke slowly and sternly, as if narrating a documentary, railing against a litany of national hardships: gun violence, economic inequality, an overreliance on the police to remedy societal ills.

She suggested reassuringly that America had overcome much more than its recent pain and political fury.

“The challenges we face today do not approach those of Lincoln’s time. Not even close,” she said. “But recent events have left people across America asking hard questions about whether we are still a house divided.”

For a candidate not known for soaring oratory, and often not especially comfortable pursuing it, the venue was something of a risky choice, inviting comparisons to some of the most stirring speakers in American history. Nearly a century and a half after Lincoln condemned slavery here, Senator Barack Obama stood before the Capitol in February 2007 to announce his bid for president.

Mrs. Clinton’s aides had billed this speech as a major address, hoping to build on remarks last week before black clergy members in Philadelphia, when she urged white Americans to “do a better job of listening when African-Americans talk.”
275 changes: 275 additions & 0 deletions exampleSorting.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,275 @@
The number of words are 274
the,17
of,15
a,14
to,10
on,8
in,8
as,7
and,7
an,5
for,5
Clinton,4
she,4
Mrs.,4
She,4
that,4
before,3
national,3
not,3
house,2
Wednesday,2
Party,2
Lincoln’s,2
Capitol,2
history.,2
even,2
American,2
week,2
her,2
police,2
violence,2
here,,2
against,2
hoping,2
small,2
Lincoln,2
often,2
I,2
have,2
do,2
—,2
was,2
his,2
speech,2
America,2
had,2
recent,2
we,2
when,2
divided,”,1
democracy,,1
grounds,1
Hillary,1
held,1
Republicans,1
plan,1
nominate,1
him,1
nearly,1
president,1
State,1
Cleveland,,1
ago,,1
set,1
off,1
delicate,1
balancing,1
act,1
transition,1
own.,1
Abraham,1
waded,1
with,1
care,1
into,1
thickets,1
forth,1
reckonings,1
over,1
On,1
Trump,,1
casting,1
present,1
police,,1
moment,1
position,1
herself,1
unlikely,1
agent,1
harmony.,1
And,1
uncharacteristic,1
admission,,1
assumed,1
responsibility,1
at,1
least,1
160,1
measure,1
fractiousness,1
discourse.,1
“I,1
cannot,1
stand,1
here,1
claim,1
where,1
my,1
words,1
actions,1
haven’t,1
sometimes,1
fueled,1
partisanship,1
indelible,1
stands,1
way,1
our,1
progress,”,1
told,1
audience,1
crowded,1
beneath,1
grand,1
ceiling,1
here.,1
“So,1
stain,1
recognize,1
Republican,1
“a,1
better,,1
too.”,1
Though,1
has,1
weeks,1
stressed,1
unity,1
binding,1
theme,1
campaign,1
Yet,1
making,1
speeches,1
front,1
“Stronger,1
Together”,1
signs,1
staging,1
lamented,1
particularly,1
unsubtle.,1
immediately,1
invoked,1
President,1
Lincoln,,1
quoting,1
from,1
years,1
savaged,1
June,1
16,,1
1858.,1
spoke,1
slowly,1
sternly,,1
if,1
narrating,1
documentary,,1
railing,1
litany,1
hardships:,1
gun,1
violence,,1
economic,1
inequality,,1
overreliance,1
remedy,1
societal,1
ills.,1
suggested,1
reassuringly,1
Donald,1
J.,1
overcome,1
much,1
more,1
than,1
its,1
Trump,1
pain,1
political,1
fury.,1
“The,1
challenges,1
existential,1
face,1
today,1
Old,1
approach,1
those,1
time.,1
Not,1
close,”,1
said.,1
“But,1
events,1
left,1
people,1
across,1
asking,1
hard,1
questions,1
about,1
whether,1
are,1
still,1
divided.”,1
For,1
candidate,1
known,1
soaring,1
oratory,,1
especially,1
comfortable,1
pursuing,1
it,,1
venue,1
something,1
risky,1
choice,,1
inviting,1
comparisons,1
some,1
most,1
stirring,1
speakers,1
Nearly,1
century,1
half,1
after,1
condemned,1
slavery,1
Senator,1
Barack,1
Obama,1
stood,1
February,1
2007,1
announce,1
bid,1
president.,1
Clinton’s,1
aides,1
billed,1
this,1
major,1
address,,1
build,1
remarks,1
last,1
black,1
clergy,1
members,1
Philadelphia,,1
threat,1
urged,1
white,1
Americans,1
“do,1
better,1
job,1
listening,1
African-Americans,1
talk.”,1
Loading