def __createNormalizedVectorRepresentation(self, tokens_list, cl = None, tfidf = True):
        vec = np.zeros((len(self.tdict), 1))
        for token in tokens_list:
            if token in self.tdict:
                vec[self.tdict[token][idx_lbl], 0] += 1

        token_set = set(tokens_list)
        if tfidf:
            if cl != None:
                for term in token_set:
                    if cl in self.tdict[term]:
                        vec[self.tdict[term][idx_lbl], 0] *= np.log(self.ctermcnt[self.lbl_dict[cl], 0] * 1.0 / self.tdict[term][cl])


        norm_vec = np.linalg.norm(vec)
        vec = (vec / (norm_vec + 1e-14))
        return vec
this method will create a vector space representation of the list of tokens provided with unit length
dataset/ETHPy150Open erfannoury/TextClassification/Rocchio.py/Rocchio.__createNormalizedVectorRepresentation