Exemple #1
0
 def expanded_vector(self, terms, limit_per_term=10, include_neighbors=True):
     # TODO: docstring
     self.load()
     return weighted_average(
         self.frame,
         self.expand_terms(terms, limit_per_term, include_neighbors)
     )
Exemple #2
0
    def expanded_vector(self, terms, oov_vector=True):
        """
        Given a list of weighted terms as (term, weight) tuples, make a vector
        representing information from:

        - The vectors for these terms
        - The vectors for equivalently spelled terms in the English vocabulary
        - The vectors for terms that share a sufficiently-long prefix with
          any terms in this list that are out-of-vocabulary
        """
        return weighted_average(self.frame,
                                self.expand_terms(terms, oov_vector))
Exemple #3
0
    def expanded_vector(self, terms, limit_per_term=10, oov_vector=True):
        """
        Given a list of weighted terms as (term, weight) tuples, make a vector
        representing information from:

        - The vectors for these terms
        - The vectors for their neighbors in ConceptNet
        - The vectors for terms that share a sufficiently-long prefix with
          any terms in this list that are out-of-vocabulary
        """
        self.load()
        return weighted_average(
            self.frame, self.expand_terms(terms, limit_per_term, oov_vector))
Exemple #4
0
    def expanded_vector(self, terms, limit_per_term=10, oov_vector=True):
        """
        Given a list of weighted terms as (term, weight) tuples, make a vector
        representing information from:

        - The vectors for these terms
        - The vectors for their neighbors in ConceptNet
        - The vectors for terms that share a sufficiently-long prefix with
          any terms in this list that are out-of-vocabulary
        """
        self.load()
        return weighted_average(
            self.frame, self.expand_terms(terms, limit_per_term, oov_vector)
        )
Exemple #5
0
 def expanded_vector(self, terms, limit_per_term=10, include_neighbors=True):
     self.load()
     return weighted_average(self.frame, self.expand_terms(terms, limit_per_term, include_neighbors))