coordle/backend/coordle_backend.py
def _tf_idf(self, docs: set, token: str):
        '''
        Given a set CordDoc objects and a token, calculate TF-IDF relevance for
        the objects with respect to the token and then store the value inside 
        uidcache. 
        '''    
        for doc in docs:
            if doc.uid not in self.uidcache:
                self.uidcache[doc.uid] = 0.0

            idf = np.log(len(self.index) / len(docs))
            tf = doc.wordcounts[token] / len(doc)
            self.uidcache[doc.uid] += tf*idf

        Given a set CordDoc objects and a token, calculate TF-IDF relevance for
        the objects with respect to the token and then store the value inside 
        uidcache. 
        
Given a set CordDoc objects and a token, calculate TF-IDF relevance for
the objects with respect to the token and then store the value inside
uidcache.
Given a set CordDoc objects and a token calculate TF - IDF relevance for the objects with respect to the token and then store the value inside uidcache .
def _tf_idf(self, docs: set, token: str):
        for doc in docs:
            if doc.uid not in self.uidcache:
                self.uidcache[doc.uid] = 0.0
            idf = np.log(len(self.index) / len(docs))
            tf = doc.wordcounts[token] / len(doc)
            self.uidcache[doc.uid] += tf*idf
def _tf_idf ( self , docs : set , token : str ) : for doc in docs : if doc . uid not in self . uidcache : self . uidcache [ doc . uid ] = 0.0 idf = np . log ( len ( self . index ) / len ( docs ) ) tf = doc . wordcounts [ token ] / len ( doc ) self . uidcache [ doc . uid ] += tf * idf
Given a set CordDoc objects and a token, calculate TF-IDF relevance for
the objects with respect to the token and then store the value inside
uidcache.
Given a set CordDoc objects and a token calculate TF - IDF relevance for the objects with respect to the token and then store the value inside uidcache .
'''
        Given a set CordDoc objects and a token, calculate TF-IDF relevance for
        the objects with respect to the token and then store the value inside 
        uidcache. 
        '''
self
docs
set
token
str