team4alfanous team mailing list archive
-
team4alfanous team
-
Mailing list archive
-
Message #00158
[Branch ~team4alfanous/alfanous/alfanous-git] Rev 345: test sample for quick start
------------------------------------------------------------
revno: 345
committer: Assem Chelli <assem.ch@xxxxxxxxx>
timestamp: Sat 2012-09-29 21:51:27 +0100
message:
test sample for quick start
added:
src/alfanous-tests/sample.py
--
lp:alfanous
https://code.launchpad.net/~team4alfanous/alfanous/alfanous-git
Your team Alfanous team is subscribed to branch lp:alfanous.
To unsubscribe from this branch go to https://code.launchpad.net/~team4alfanous/alfanous/alfanous-git/+edit-subscription
=== added file 'src/alfanous-tests/sample.py'
--- src/alfanous-tests/sample.py 1970-01-01 00:00:00 +0000
+++ src/alfanous-tests/sample.py 2012-09-29 20:51:27 +0000
@@ -0,0 +1,53 @@
+# coding: utf-8
+
+# import Output object
+from alfanous.Outputs import Raw
+
+# import default Paths
+from alfanous.Data import Paths
+
+# Initialize search engines
+RAWoutput = Raw(
+ QSE_index = Paths.QSE_INDEX, # Quranic Main index path
+ TSE_index = Paths.TSE_INDEX, # Translations index path
+ WSE_index = Paths.WSE_INDEX, # Quranic words index path
+ Recitations_list_file = Paths.RECITATIONS_LIST_FILE,
+ Translations_list_file = Paths.TRANSLATIONS_LIST_FILE ,
+ Hints_file = Paths.HINTS_FILE,
+ Stats_file = Paths.STATS_FILE,
+ Information_file = Paths.INFORMATION_FILE
+ )
+
+## prepare a suggestion query
+suggest_flags = {
+ "action":"suggest",
+ "query": "ابراهيم"
+ }
+
+results = RAWoutput.do( suggest_flags )
+
+print "number of missed words", len(results["suggest"])
+
+
+## prepare a search query
+search_flags = {
+ "action":"search",
+ "query": "الحمد لله",
+ "sortedby":"mushaf",
+ "reverse_order": False,
+ "page": 1,
+ "word_info": True,
+ "highlight": "css",
+ "script": "standard",
+ "sura_info": True,
+ "aya_position_info": True,
+ "aya_theme_info": False,
+ "aya_stat_info": False,
+ "aya_sajda_info": True,
+ "translation": 2,
+ }
+
+results = RAWoutput.do( search_flags )
+
+print "runtime", results["search"]["runtime"]
+print "total", results["search"]["interval"]["total"]