← Back to team overview

team4alfanous team mailing list archive

[Branch ~team4alfanous/alfanous/alfanous-git] Rev 453: fix a bug in getting keyword derivations (fix #134)

 

------------------------------------------------------------
revno: 453
committer: Assem Chelli <assem.ch@xxxxxxxxx>
timestamp: Sat 2012-11-24 01:27:04 +0100
message:
  fix a bug in getting keyword derivations (fix #134) 
  
  happened when search using a keyword doesn't exist in the derivations mapping dict
modified:
  src/alfanous/Outputs.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
=== modified file 'src/alfanous/Outputs.py'
--- src/alfanous/Outputs.py	2012-11-22 23:12:08 +0000
+++ src/alfanous/Outputs.py	2012-11-24 00:27:04 +0000
@@ -403,7 +403,8 @@
 						matches += term[2]
 					docs += term[3]
 					annotation_word_query += u" OR normalized:%s " % STANDARD2UTHMANI( term[1] )
-					vocalizations = vocalization_dict[term[1]]
+					vocalizations = vocalization_dict[term[1]] if vocalization_dict.has_key(term[1]) \
+										   else []
 					nb_vocalizations_globale += len( vocalizations )
 					words_output[ cpt ] = {"word":term[1], "nb_matches":term[2], "nb_ayas":term[3], "nb_vocalizations": len( vocalizations ), "vocalizations": vocalizations}
 					cpt += 1