Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unique ngram, division by lenght of document #51

Open
alessandropec opened this issue Jul 3, 2021 · 0 comments
Open

Unique ngram, division by lenght of document #51

alessandropec opened this issue Jul 3, 2021 · 0 comments

Comments

@alessandropec
Copy link

alessandropec commented Jul 3, 2021

I think there is an error inside the class unique ngram, the right computation of ngram should be #unique_grams/#grams

def get_ng(self):
        document = self.get_reference()
        length = len(document) #is this a bug? to get ngramm is needed to divide uniquengram by all ngram, not len of sentence!
        grams = list()
        for sentence in document:
            
        grams += self.get_gram(sentence)
        print(grams,len(set(grams)),len(grams))
        
        #to get ngrams is divide by number of grams not by number of sentence
        return len(set(grams))/length` #The right computation should use len(grams) instead of length
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant