• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python searcher.Searcher类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中searcher.Searcher的典型用法代码示例。如果您正苦于以下问题:Python Searcher类的具体用法?Python Searcher怎么用?Python Searcher使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了Searcher类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。

示例1: search

def search():
    global index
    query = request.args.get('q')
    doc_set = request.args.get('d')
    doc_set_names = DocSet(index_directory).get_doc_set_names()
    if query:
        if doc_set != 'all':
            actual_query = u"text:%s doc_set:%s" % (
                query, doc_set)
        else:
            actual_query = query
        searcher = Searcher(index)
        results = searcher.find_by_full_text(actual_query)
        if results:
            message = None
        else:
            message = 'No documents found.'
        return render_template("index.html", 
                               results = results, 
                               message = message,
                               query = query,
                               selected_doc_set = doc_set,
                               doc_set_names = doc_set_names)
    else:
        return render_template("index.html", 
                               doc_set_names = doc_set_names)
开发者ID:timjstewart,项目名称:dexter,代码行数:26,代码来源:dexter.py


示例2: search

def search(request, search=None, cats=None, scats=None):
    page_number = request.GET.get('page', 1)
    searcher = Searcher(search, cats, scats)
    snps = Post.objects.order_by('-posted')
    snps = searcher.filter_queryset(snps)
    searcher.unfilter_categories()

    selector = QuerySelector(snps, dict(
        download=DownloadNzbAction(),
    ))

    if request.method == 'POST':
        action_response = selector.apply_action(request)
        if isinstance(action_response, HttpResponse):
            return action_response

    paginator = Paginator(
        selector,
        settings.POST_PER_PAGE,
        allow_empty_first_page=True,
        orphans=0,
    )

    if page_number == "last":
        page = paginator.page(paginator.num_pages)
    else:
        try:
            page = paginator.page(page_number)
        except InvalidPage, EmptyPage:
            raise Http404
开发者ID:alvra,项目名称:django-spotnet,代码行数:30,代码来源:views.py


示例3: search

 def search(self, query):
     """
     Search in the index for answer to query and return a list of relevant
     urls.
     """
     self._logger.info('query: ' + query)
     searcher = Searcher()
     return searcher.query(query)
开发者ID:Flolagale,项目名称:banana,代码行数:8,代码来源:banana.py


示例4: scrape

 def scrape(self):
     self.scrape_results = defaultdict(lambda: defaultdict(list))
     for category_of_document_path in self.qd_dict:
         for file in self.qd_dict[category_of_document_path]:
             s = Searcher(category_of_document_path, file, self.qd_dict)
             s.search()
             self.scrape_results[os.path.split(category_of_document_path)[1]][os.path.splitext(file)[0]] = s.results
     print len(self.scrape_results)
开发者ID:blindidiot91,项目名称:ASTM-Mapping,代码行数:8,代码来源:scraper.py


示例5: find_torrent

    def find_torrent(self):
        print 'Start capturing torrent'
        searcher = Searcher(self.driver)
        items = []

        while(True):
            searcher.find_torrents(items)
            time.sleep(60)
            self.driver.refresh()
开发者ID:niminjie,项目名称:u2notify,代码行数:9,代码来源:u2.py


示例6: SearcherTests

class SearcherTests(unittest.TestCase):

	def setUp(self):
		self.alist = [2,3,4,5,6,11,25]
		self.searcher = Searcher()

	def test_binarySearch(self):
		self.assertEqual(True, self.searcher.binary_search(self.alist, 2))
		self.assertEqual(True, self.searcher.binary_search(self.alist, 25))
		self.assertEqual(True, self.searcher.binary_search(self.alist, 5))
		self.assertEqual(False, self.searcher.binary_search(self.alist, 7))
		self.assertEqual(False, self.searcher.binary_search(self.alist, 26))
开发者ID:copland,项目名称:python_algorithms,代码行数:12,代码来源:test_searcher.py


示例7: main

def main():
    searcher = Searcher("data.json")
    while True:
        print
        response = "n"
        print "=================================="
        while response != "y":
            response = raw_input("Ready to say something? (y/n)")
        q, filters = query_speech()
        if not q:
            continue
        print "Filters:"
        print filters
        print searcher.process_query(q, filters)
开发者ID:UMGQ,项目名称:YelpNLSearch,代码行数:14,代码来源:test_speech.py


示例8: search

def search(keywords):

    keyword_list = keywords.split(" ")
    collector = Collector()
    if collector.is_meiju_info_file_exist():
        collector.read_all_meiju_info_from_file()
    else:
        collector.save_all_meiju_info()
        collector.write_all_meiju_info_to_file()
    searcher = Searcher()
    meiju_ename_list = searcher.search_meiju_list_by_english_name_keyword(collector, keyword_list)
    click.echo("Total %d Meiju is found. Following are the lists:" % len(meiju_ename_list))
    for meiju_ename in meiju_ename_list:
        click.echo("%s" % meiju_ename)
    return
开发者ID:leodengyx,项目名称:LeoMeijuDownloader,代码行数:15,代码来源:__main__.py


示例9: Match

def Match(queryname,k):
    folder="static"
    queryImage = cv2.imread(os.path.join(folder,queryname))
    desc = RGBHistogram([8, 8, 8])
    # load the index perform the search
    #index = cPickle.loads(open("index.txt").read())
    d = min(division(queryImage),7)
    folder='indexIMG'
    index = shelve.open(os.path.join(folder,'f%d.shelve'%d))
    searcher = Searcher(index)
    
    queryFeatures = desc.describe(queryImage)
    results = searcher.search(queryFeatures)
    l=len(results)
    lastRes=results[:min(k,l)]
    return lastRes
开发者ID:LeiHaoruo,项目名称:BookSearchEngine,代码行数:16,代码来源:cbir.py


示例10: __init__

    def __init__(self, parent = None):
        super(MainWindow, self).__init__(parent)
                
        self.setupUi(self)

        self.setWindowTitle("Search My Workspace")

        # List to display search results
        self.searchResultsModel = SearchResultsModel()
        self.listView_result.setModel(self.searchResultsModel)

        searchResultsDelegate = SearchResultsDelegate(self.listView_result)
        self.listView_result.setItemDelegate(searchResultsDelegate);

        # Tree to display facets
        self.facetModel = FacetModel()
        self.treeView_facet.setModel(self.facetModel)
        self.facetModel.modelReset.connect(self.treeView_facet.expandAll)

        # searcher
        self.searcher = Searcher()
        self.searcher.searchDone.connect(self.searchDone)

        # signal slots
        self.createConnections()                
开发者ID:zhongzhu,项目名称:exercise,代码行数:25,代码来源:mainwindow.py


示例11: search

    def search(img):

        # initialize the image descriptor
        cd = ColorDescriptor((8, 12, 3))

        # load the query image and describe it
        #query = cv2.imread(args["query"])
        #query = cv2.imread("queries/2.png")

        features = cd.describe(img)

        # perform the search

        searcher = Searcher("feature.csv")

        results = searcher.search(features)
        return results
开发者ID:saucewan,项目名称:imageSearch,代码行数:17,代码来源:search.py


示例12: __init__

 def __init__(self, access_course, access_note, access_user, access_enrollment):
     """ to initialize a submit note instance """
     self.access_course = access_course
     self.access_note = access_note
     self.access_user = access_user
     self.access_enrollment = access_enrollment
     self.searcher = Searcher(self.access_course, self.access_note, self.access_user)
     self.userControl = userControl = UserControl(self.access_user, self.access_enrollment)
开发者ID:Hippocrates,项目名称:comp4350-classnotes,代码行数:8,代码来源:submit_note.py


示例13: setUp

    def setUp(self):
        """
        Setup search engine that will be subjected to the tests.
        """
        self.twitter = Twitter(CUR_DIR + "/test_crossfit.tweets", CUR_DIR + "/test_stop_words.txt")
        self.twitter.load_tweets_and_build_index()

        self.searcher = Searcher(self.twitter.tweets, self.twitter.stop_words)
开发者ID:UIKit0,项目名称:simple-search-engine,代码行数:8,代码来源:test_search.py


示例14: SearcherTests

class SearcherTests(unittest.TestCase):
    """
    Test case for SearchEngine class.
    """

    def setUp(self):
        """
        Setup search engine that will be subjected to the tests.
        """
        self.twitter = Twitter(CUR_DIR + "/test_crossfit.tweets", CUR_DIR + "/test_stop_words.txt")
        self.twitter.load_tweets_and_build_index()

        self.searcher = Searcher(self.twitter.tweets, self.twitter.stop_words)

    def test_indexed_doc_count(self):

        self.assertEqual(self.searcher.count(), 10)

    def test_existent_term_search(self):
        """
        Test if search is correctly performed.
        """
        results = self.searcher.search("coach")
        expected_results = 3

        self.assertEqual(results[0].indexable.docid, expected_results)

    def test_non_existent_term_search(self):
        """
        Test if search is correctly performed.
        """

        expected_results = []
        results = self.searcher.search("asdasdasdas")

        self.assertListEqual(results, expected_results)

    def test_search_result_limit(self):
        """
        Test if search results can be limited.
        """
        results = self.searcher.search("crossfit", 1)
        expected_results = 6

        self.assertEqual(results[0].indexable.docid, expected_results)
开发者ID:UIKit0,项目名称:simple-search-engine,代码行数:45,代码来源:test_search.py


示例15: load

 def load(self):
     if os.path.exists(self.file_path):
         f = open(self.file_path, "r")
         conn_map = pickle.load(f)
         f.close()
         return conn_map
     conn_maps = {}
     for name, conn in self.connections.items():
         conn_map = {}
         searcher = Searcher(conn)
         searcher.search()
         conn_map["tables"] = searcher.tables
         conn_map["connection"] = searcher.connection
         conn_maps[name] = conn_map
     f = open(self.file_path, "w")
     pickle.dump(conn_maps, f)
     f.close()
     return conn_maps
开发者ID:pyohei,项目名称:sandbox-piyopiyo,代码行数:18,代码来源:loader.py


示例16: MainWindow

class MainWindow(QtGui.QMainWindow, Ui_MainWindow):
       
    def __init__(self, parent = None):
        super(MainWindow, self).__init__(parent)
                
        self.setupUi(self)

        self.setWindowTitle("Search My Workspace")

        # List to display search results
        self.searchResultsModel = SearchResultsModel()
        self.listView_result.setModel(self.searchResultsModel)

        searchResultsDelegate = SearchResultsDelegate(self.listView_result)
        self.listView_result.setItemDelegate(searchResultsDelegate);

        # Tree to display facets
        self.facetModel = FacetModel()
        self.treeView_facet.setModel(self.facetModel)
        self.facetModel.modelReset.connect(self.treeView_facet.expandAll)

        # searcher
        self.searcher = Searcher()
        self.searcher.searchDone.connect(self.searchDone)

        # signal slots
        self.createConnections()                

    ''' connect signal/slot pairs '''
    def createConnections(self):
        self.pushButton_search.clicked.connect(self.searchResultsModel.clearMyModel)
        self.pushButton_search.clicked.connect(self.facetModel.clearMyModel)
        self.pushButton_search.clicked.connect(self.search)

    def search(self):
        query = self.lineEdit_search.text()
        self.searcher.search(query)

    def searchDone(self):
        self.searchResultsModel.handleSearchResults(self.searcher.getDocs())
        self.facetModel.handleSearchResults(self.searcher.getFacets())
        self.label_searchResult.setText('About {0} search results for [{1}]'.format(self.searcher.getHits(), self.searcher.getQuery()))
开发者ID:zhongzhu,项目名称:exercise,代码行数:42,代码来源:mainwindow.py


示例17: MainWindow

class MainWindow(QtGui.QMainWindow, Ui_MainWindow):

    def __init__(self, parent = None):
        super(MainWindow, self).__init__(parent)

        self.setupUi(self)

        self.searchResultsView = SearchResultsView(self.listView_result)
        self.searchResultsView.viewDetailedContent.connect(self.showDetailedContent)

        self.facetView = FacetView(self.treeView_facet)
        self.facetView.facetOptionChanged.connect(self.search)

        # searcher
        self.searcher = Searcher()
        self.searcher.searchDone.connect(self.searchDone)

        self.createConnections()

    def createConnections(self):
        self.pushButton_search.clicked.connect(self.searchResultsView.clear)
        self.pushButton_search.clicked.connect(self.facetView.clear)
        self.pushButton_search.clicked.connect(self.search)

    def search(self):
        query = self.lineEdit_search.text()
        options = self.facetView.getFacetSearchOptions()
        self.searcher.search(query, options)

    def showDetailedContent(self, fileLocation):
        myviewer = viewer.viewerSimpleFactory(fileLocation, self)
        myviewer.showDetailedContent()

    @QtCore.Slot(int)
    def searchDone(self, searchResultCount):
        if searchResultCount > 0:
            self.searchResultsView.handleSearchResults(self.searcher.getDocs(), self.searcher.getHighlighting())
            self.facetView.handleSearchResults(self.searcher.getFacets())

        self.label_searchResult.setText('About {0} search results for [{1}]'.format(searchResultCount, self.searcher.getQuery()))
开发者ID:zhongzhu,项目名称:searchmyworkspace,代码行数:40,代码来源:mainwindow.py


示例18: setUp

 def setUp(self):
   self.searcher = Searcher()
   self.mikeObj = Person("Mike", 15)
   self.mikeObj2 = Person("Mike", 99)
   self.mikeObj3 = Person("Mike", 15, "Michael")
   self.jouhan = Person("Jouhan", 22)
   self.jouhan1 = Person("Jouhan", 74)
   self.alex = Person("Alex", 15)
   self.tim = Person("Tim", 100)
   self.cat = Animal("Cat", "Red", True)
   self.fish1 = Animal("Fish", "Blue", False)
   self.fish2 = Animal("Fish", "Red", False)
   self.dog = Animal("Dog", "Black", True)
   self.human = Animal("Human", "White", True)
开发者ID:mikelewis,项目名称:ObjectSearcher,代码行数:14,代码来源:tests.py


示例19: main_search

	def main_search(self):
		cd = ColorDescriptor((8, 12, 3))

		# load the query image and describe it
		query = cv2.imread('test_dataset/'+self.name)
		features = cd.describe(query)

		# perform the search
		searcher = Searcher(self.file_path)
		results = searcher.search(features)

		# display the query
		cv2.imshow("Query",query)

		# loop over the results
		for (score, resultID) in results:
			# load the result image and display it
			result = cv2.imread(self.data_path + "/" + resultID)
			r=300.0/result.shape[1]
			dim=(300,int(result.shape[0]*r))
			resized = cv2.resize(result, dim, interpolation = cv2.INTER_AREA)
			cv2.imshow("RESULT", resized)
			cv2.waitKey(0)
			cv2.destroyAllWindows()	
开发者ID:farhan0581,项目名称:CBIR,代码行数:24,代码来源:search.py


示例20: __init__

    def __init__(self, parent = None):
        super(MainWindow, self).__init__(parent)

        self.setupUi(self)

        self.searchResultsView = SearchResultsView(self.listView_result)
        self.searchResultsView.viewDetailedContent.connect(self.showDetailedContent)

        self.facetView = FacetView(self.treeView_facet)
        self.facetView.facetOptionChanged.connect(self.search)

        # searcher
        self.searcher = Searcher()
        self.searcher.searchDone.connect(self.searchDone)

        self.createConnections()
开发者ID:zhongzhu,项目名称:searchmyworkspace,代码行数:16,代码来源:mainwindow.py



注:本文中的searcher.Searcher类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python utils.get_search_plugins函数代码示例发布时间:2022-05-27
下一篇:
Python views.fix_search_query函数代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap