Example #1
0
 def __init__(self, stopword_file, background_file=[]):
     super(SingleReversedTriReversedInterleavedGenerator,
           self).__init__(stopword_file, background_file=background_file)
     self.__single = SingleTermQueryGeneratorReversed(
         stopword_file, background_file)
     self.__tri = TriTermQueryGeneratorReversed(stopword_file,
                                                background_file)
Example #2
0
class SingleReversedTriReversedInterleavedGenerator(BaseQueryGenerator):
    """
    Takes the SingleTermGeneratorReversed and the TriTermGenerator, and interleaves like [Single,Tri,Single,Tri,Single,Tri...]
    """
    def __init__(self, stopword_file, background_file=[]):
        super(SingleReversedTriReversedInterleavedGenerator,
              self).__init__(stopword_file, background_file=background_file)
        self.__single = SingleTermQueryGeneratorReversed(
            stopword_file, background_file)
        self.__tri = TriTermQueryGeneratorReversed(stopword_file,
                                                   background_file)

    def generate_query_list(self, search_context):
        """
        Given a Topic object, produces a list of query terms that could be issued by the simulated agent.
        """
        topic = search_context.topic
        single_queries = self.__single.generate_query_list(search_context)
        tri_queries = self.__tri.generate_query_list(search_context)

        interleaved_queries = [
            val for pair in zip(single_queries, tri_queries) for val in pair
        ]

        return interleaved_queries
class SingleReversedTriReversedInterleavedGenerator(BaseQueryGenerator):
    """
    Takes the SingleTermGeneratorReversed and the TriTermGenerator, and interleaves like [Single,Tri,Single,Tri,Single,Tri...]
    """
    def __init__(self,  stopword_file, background_file=[]):
        super(SingleReversedTriReversedInterleavedGenerator, self).__init__(stopword_file, background_file=background_file)
        self.__single = SingleTermQueryGeneratorReversed(stopword_file, background_file)
        self.__tri = TriTermQueryGeneratorReversed(stopword_file, background_file)

    def generate_query_list(self, search_context):
        """
        Given a Topic object, produces a list of query terms that could be issued by the simulated agent.
        """
        topic = search_context.topic
        single_queries = self.__single.generate_query_list(search_context)
        tri_queries = self.__tri.generate_query_list(search_context)
        
        interleaved_queries = [val for pair in zip(single_queries, tri_queries) for val in pair]

        return interleaved_queries
 def __init__(self,  stopword_file, background_file=[]):
     super(SingleReversedTriReversedInterleavedGenerator, self).__init__(stopword_file, background_file=background_file)
     self.__single = SingleTermQueryGeneratorReversed(stopword_file, background_file)
     self.__tri = TriTermQueryGeneratorReversed(stopword_file, background_file)