コード例 #1
0
	cp = CorpusHandler(debug=False, db=db)
	cp.drop()

	s = time.time()
	for a in data:
		try:
			cp.index(a)
		except:
			pass


	print "indexing: " , time.time() - s


	q = QueryHandler(debug=False, db=db, use_lua=True)
	q2 = QueryHandler(debug=False, db=db, use_lua=False)

	
	qs = ["ακόρεστο θηλυκό", "ευάλωτη παρθένα", "ξέσπασα ολόλευκος", "κάμπος ανθισμένος"] # lol

	s = time.time()
	'''for i in qs:
		q.process_query(i)
	print "q " , time.time() - s

	s = time.time()
	for i in qs:
		q2.process_query(i)
	print "q2 " , time.time() - s'''
コード例 #2
0
ファイル: test_query.py プロジェクト: hymloth/pyredise

	cp = CorpusHandler(debug=False, db=db)
	cp.drop()


	s = time.time()
	for a in articles:

		cp.index(a)


	print "indexing: " , time.time() - s

	
	q = QueryHandler(debug=False, db=db, use_lua=True)
	q2 = QueryHandler(debug=False, db=db, use_lua=False)

	s = time.time()

	q.process_query("the brown")
	q.process_query("Den raske brune")
	q.process_query("Den hurtige brune ræv")
	q.process_query("Быстрая коричневая лиса")
	q.process_query("Den raske brune")
	q.process_query("De snelle bruine")
	q.process_query("Nopea ruskea kettu hyppää")

	q.process_query("Le rapide renard brun saute")
	q.process_query("Der schnelle braune Fuchs")
	q.process_query("A gyors barna róka átugorja a lusta kutyát")
コード例 #3
0
    for i, text in enumerate(texts):
        articles.append({"content": text, "title": text[:15], "id": i + 1})

    db = redis.Redis(host='192.168.1.3', port=6666, db=3)

    cp = CorpusHandler(debug=False, db=db)
    cp.drop()

    s = time.time()
    for a in articles:

        cp.index(a)

    print "indexing: ", time.time() - s

    q = QueryHandler(debug=False, db=db, use_lua=True)
    q2 = QueryHandler(debug=False, db=db, use_lua=False)

    s = time.time()

    q.process_query("the brown")
    q.process_query("Den raske brune")
    q.process_query("Den hurtige brune ræv")
    q.process_query("Быстрая коричневая лиса")
    q.process_query("Den raske brune")
    q.process_query("De snelle bruine")
    q.process_query("Nopea ruskea kettu hyppää")

    q.process_query("Le rapide renard brun saute")
    q.process_query("Der schnelle braune Fuchs")
    q.process_query("A gyors barna róka átugorja a lusta kutyát")