From 95f3c5366b75c71e107fab7988265abbf7b87502 Mon Sep 17 00:00:00 2001 From: Nathan Smith Date: Sat, 6 Aug 2022 02:49:48 -0400 Subject: [PATCH] Developed wordcount program and added test files. --- arrl.txt | 47 +++++++++++++++++++++++++++++++++++++++++++++++ gettysburg.txt | 3 +++ wordcount.py | 38 ++++++++++++++++++++++++++++++++++++++ 3 files changed, 88 insertions(+) create mode 100644 arrl.txt create mode 100644 gettysburg.txt diff --git a/arrl.txt b/arrl.txt new file mode 100644 index 0000000..86d4773 --- /dev/null +++ b/arrl.txt @@ -0,0 +1,47 @@ +METEOROLOGISTS AT MILLERSVILLE UNIVERSITY AND IS WORKING WITH ARRL +AND HAMSCI TO CREATE EDUCATIONAL MATERIALS. SPECIAL ACHIEVEMENT +WESLEY LAMBOLEY, W3WL, WAS NOMINATED BY HIS PEERS FOR HIS LIFELONG, +HIGH ENERGY SUPPORT OF THE SCIENCE AND ART OF AMATEUR RADIO. NOT +ONLY HAS HE SUPPORTED YOUTH COACHING, MEMBERSHIP RECRUITING, AND +TECHNICAL PROBLEM ASSISTANCE, HE ALWAYS DOES IT WITH A SMILE AND +GREAT HUMOR, THE AWARDS COMMITTEE SAID. LAMBOLEY SPENT 40 YEARS IN +THE AERO SPAC HAPPENINGS ARRL TO EXTEND FIELD DAY RULE WAIVERS FROM +2020, ADD CLASS D AND E POWER LIMIT THE COVID 19 PANDEMIC MODIFIED +ARRL FIELD DAY RULES FROM 2020 WILL CONTINUE THIS JUNE WITH A POWER +LIMIT IMPOSED ON CLASS D HOME STATIONS AND CLASS E HOME STATIONS +EMERGENCY POWER PARTICIPANTS. FEBRUARYS NEWS FROM THE ARRL BOARDS +PROGRAMS AND SERVICES COMMITTEE CAME AS MANY CLUBS AND GROUPS WERE +STARTING PREPARATIONS FOR FIELD DAY IN EARNEST. FIELD DAY 2021 +TAKES PLACE JUNE 26 27. THIS EARLY DECISION SHOULD ALLEVIATE ANY +HESITANCY THAT RADIO CLUBS AND INDIVIDUAL FIELD DAY PARTICIPANTS MAY +HAVE WITH THEIR PLANNING FOR THE EVENT, SAID ARRL CONTEST PROGRAM +MANAGER PAUL BOURQUE, N1SFE. FOR FIELD DAY 2021, CLASS D STATIONS +MAY WORK ALL OTHER FIELD DAY STATIONS, INCLUDING OTHER CLASS D +STATIONS, FOR POINTS. THIS YEAR, HOWEVER, CLASS D AND CLASS E +STATIONS WILL BE LIMITED TO 150 W PEP OUTPUT. FOR FIELD DAY 2021, +AN AGGREGATE CLUB SCORE WILL BE PUBLISHED, AS WAS DONE LAST YEAR. +THE AGGREGATE SCORE WILL BE A SUM OF ALL INDIVIDUAL ENTRIES WHO +ATTRIBUTED THEIR SCORE TO THAT OF A SPECIFIC CLUB. ARRL FIELD DAY +IS ONE OF THE BIGGEST EVENTS ON THE AMATEUR RADIO CALENDAR. LAST +SUMMER, A RECORD 10,213 ENTRIES WERE RECEIVED. WITH THE GREATER +FLEXIBILITY AFFORDED BY THE RULES WAIVERS, INDIVIDUALS AND GROUPS +WILL STILL BE ABLE TO PARTICIPATE IN FIELD DAY, WHILE STILL STAYING +WITHIN ANY PUBLIC HEALTH RECOMMENDATIONS OR REQUIREMENTS, BOURQUE +SAID. THE PREFERRED METHOD OF SUBMITTING ENTRIES AFTER FIELD DAY IS +VIA THE WEB APPLET. THE ARRL FIELD DAY RULES, FOUND ELSEWHERE IN +THIS ISSUE, INCLUDE INSTRUCTIONS ON HOW TO SUBMIT ENTRIES, WHICH +MUST BE SUBMITTED OR POST MARKED BY TUESDAY, JULY 27, 2021. +INNOVATOR ULRICH ROHDE, N1UL, DONATES SOPHISTICATED VECTOR SIGNAL +GENERATOR TO ARRL ARRL LIFE MEMBER ULRICH ROHDE, N1UL, HAS DONATED A +ROHDE SCHWARZ SMBV100A VECTOR SIGNAL GENERATOR TO THE ARRL +LABORATORY. THE DEVICE OFFERS INTERNAL SIGNAL GENERATION FOR ALL +MAJOR DIGITAL RADIO STANDARDS. THAT IS ABSOLUTELY FABULOUS NEWS AND +EXTREMELY GENEROUS, ARRL CEO DAVID MINSTER, NA2AA, TOLD ROHDE. ARRL +LABORATORY MANAGER ED HARE, W1RFI, SAID THE INSTRUMENT WILL BE A +VALUABLE ADDITION TO THE LABS TESTING CAPABILITIES. WE WILL BE ABLE +TO DO MORE COMPREHENSIVE TESTS ON MODERN RADIOS, ALMOST ALL OF WHICH +USE SOFTWARE DEFINED RADIO TECHNOLOGY, HARE SAID. WE WILL ALSO BE +ABLE TO ADD TESTING OF RECEIVERS DIGITAL CAPABILITY. THE +FLEXIBILITY OF THIS GENERATOR WILL SERVE THE LABORATORY FOR YEARS TO +COME. HARE SAID HE WAS LOOKING FORWARD TO LEARNING MORE ABOUT THE +SMBV100A ONCE ITS INSTALLED \ No newline at end of file diff --git a/gettysburg.txt b/gettysburg.txt new file mode 100644 index 0000000..62f25d6 --- /dev/null +++ b/gettysburg.txt @@ -0,0 +1,3 @@ +Four score and seven years ago our fathers brought forth, on this continent, a new nation, conceived in Liberty, and dedicated to the proposition that all men are created equal. +Now we are engaged in a great civil war, testing whether that nation, or any nation so conceived and so dedicated, can long endure. We are met on a great battle-field of that war. We have come to dedicate a portion of that field, as a final resting place for those who here gave their lives that that nation might live. It is altogether fitting and proper that we should do this. +But, in a larger sense, we can not dedicate—we can not consecrate—we can not hallow—this ground. The brave men, living and dead, who struggled here, have consecrated it, far above our poor power to add or detract. The world will little note, nor long remember what we say here, but it can never forget what they did here. It is for us the living, rather, to be dedicated here to the unfinished work which they who fought here have thus far so nobly advanced. It is rather for us to be here dedicated to the great task remaining before us—that from these honored dead we take increased devotion to that cause for which they gave the last full measure of devotion—that we here highly resolve that these dead shall not have died in vain—that this nation, under God, shall have a new birth of freedom—and that government of the people, by the people, for the people, shall not perish from the earth. \ No newline at end of file diff --git a/wordcount.py b/wordcount.py index e69de29..cd6d983 100644 --- a/wordcount.py +++ b/wordcount.py @@ -0,0 +1,38 @@ +import sys + +file = open(sys.argv[1], "r") + +inputFile = file.read() + +inputFile = inputFile.lower() + +splitLine = inputFile.splitlines() + +uniqueWords = set() +totalWords = 0 +wordDict = {} + +for line in splitLine: + line = line.replace(",", " ") + line = line.replace(".", " ") + line = line.replace("—", " ") + line = line.replace(":", " ") + line = line.replace(";", " ") + line = line.replace("!", " ") + line = line.replace("?", " ") + line = line.replace("/", " ") + line = line.replace("\\", " ") + wordList = line.split() + wordCount = 0 + for word in wordList: + wordCount = wordCount + 1 + uniqueWords.add(word) + if word in wordDict: + wordDict[word] = wordDict[word] + 1 + else: + wordDict[word] = 1 + totalWords = totalWords + wordCount +print("Total Words: " + str(totalWords)) +print("Unique Words: " + str(len(uniqueWords))) +for word in wordDict: + print(word + " - " + str(wordDict[word]))