SophiaPretty

(5)

$14/per page/Negotiable

About SophiaPretty

Levels Tought:
Elementary,Middle School,High School,College,University,PHD

Expertise:
Accounting,Algebra See all
Accounting,Algebra,Applied Sciences,Architecture and Design,Art & Design,Biology,Business & Finance,Calculus,Chemistry,Communications,Computer Science,Economics,Engineering,English,Environmental science,Essay writing Hide all
Teaching Since: Jul 2017
Last Sign in: 314 Weeks Ago
Questions Answered: 15833
Tutorials Posted: 15827

Education

  • MBA,PHD, Juris Doctor
    Strayer,Devery,Harvard University
    Mar-1995 - Mar-2002

Experience

  • Manager Planning
    WalMart
    Mar-2001 - Feb-2009

Category > Computer Science Posted 20 Dec 2017 My Price 10.00

modify this code match with the assignment's requirements

Hey can you modify this code match with the assignment's requirements?

http://www2.cs.uh.edu/~acl/cs1306/Assignment/prog9.pdf

  • #Step 1
    f = open('stopwords.txt', "r")
    content = f.readlines()
    stopwords = [x.replace('\n','') for x in content]
    print("List of Stop words")
    print(stopwords)
    #Step 3: read from the text file, line by line and clean words
    allWords = []
    fl = open('news.txt', "r", errors='ignore')
    lines = fl.readlines()
    print("\n\n")
    f2 = open('news.txt', "r", errors='ignore')
    print(f2.read())
    for line in lines:
          #remove punctuations
          punctuations = ["?",".","!","/",";",":","-","(",")",",","$",'"',".",'\n']
          for punctuation in punctuations:
                if punctuation in line:
                      line = line.replace(punctuation, "")
          #change to lowercase
          line = line.lower()
          words = line.split(' ')
          #add words to a wordlist
          allWords.extend(words)
    print('\nWordlist: ')
    print(allWords)
    allWords.sort()
    print('\nWord List Sorted: ')
    print(allWords)
    #remove stopwords, & numbers
    for w in allWords:
          for _ in range(allWords.count(w)):
                allWords.remove(w)
    print('\nStop Word Removed ')
    print(allWords)  
    nonNumeric = []  
    for w in allWords:
          if (w.isnumeric()==False):
                nonNumeric.append(w)
    print('\nNumbers Removed ')
    print(nonNumeric)
    #remove duplicates
    nonDuplicates = []
    for w in nonNumeric:
          if w not in nonDuplicates:
                nonDuplicates.append(w)
    print('\nDuplicated words Removed ')     
    print(nonDuplicates)

Attachments:

Answers

(5)
Status NEW Posted 20 Dec 2017 02:12 PM My Price 10.00

-----------  ----------- H-----------ell-----------o S-----------ir/-----------Mad-----------am ----------- Th-----------ank----------- yo-----------u f-----------or -----------you-----------r i-----------nte-----------res-----------t a-----------nd -----------buy-----------ing----------- my----------- po-----------ste-----------d s-----------olu-----------tio-----------n. -----------Ple-----------ase----------- pi-----------ng -----------me -----------on -----------cha-----------t I----------- am----------- on-----------lin-----------e o-----------r i-----------nbo-----------x m-----------e a----------- me-----------ssa-----------ge -----------I w-----------ill----------- be----------- qu-----------ick-----------ly

Not Rated(0)