python-scraping icon indicating copy to clipboard operation
python-scraping copied to clipboard

Chapter 8: 2-countUncommon2Grams.py

Open ghost opened this issue 8 years ago • 2 comments

First of all, I really enjoying working though all the examples in the book, however, on this specific chapter I am lost. You have a function isCommon but never use it in the program.

test

Also, the output that you have in the book does not match with what you have in this repo.

r2

I am confused can you please advised? Thank you!

ghost avatar Jan 13 '17 22:01 ghost

@fabienthiombiano I solved putting:

        words = input[i:i+n]
        # check if any of the words forming the n-gram is "common"
        if isCommon(words):
            continue

in the ngrams function, after the for loop:

...
for i in range(len(input)-n+1):

        words = input[i:i+n]
        # check if any of the words forming the n-gram is "common"
        if isCommon(words):
            continue

        ngramTemp = " ".join(input[i:i+n])
...

daviddoji avatar Mar 04 '17 17:03 daviddoji

I have the same problem, but you've done it well. It's great.

shelleychason avatar Dec 28 '17 16:12 shelleychason