team4alfanous team mailing list archive
-
team4alfanous team
-
Mailing list archive
-
Message #00059
[Branch ~team4alfanous/alfanous/alfanous-git] Rev 254: fix annotations in JSON2
------------------------------------------------------------
revno: 254
git commit: 4bcbf9712c20f0afb4832562be5096f799f2adad
committer: Assem Chelli <assem.ch@xxxxxxxxx>
timestamp: Mon 2012-06-11 07:42:48 +0100
message:
fix annotations in JSON2
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-06-09 02:30:47 +0000
+++ src/alfanous/outputs.py 2012-06-11 06:42:48 +0000
@@ -419,7 +419,7 @@
for cpt in xrange( 1, len( termz ) + 1 ):
current_word = STANDARD2UTHMANI( output["words"][cpt]["word"] )
#print current_word.encode( "utf-8" ), "=>", annotations_by_word, "=>", list( annot_res )
- if current_word in terms_uthmani:
+ if annotations_by_word.has_key( current_word ):
current_word_annotations = annotations_by_word[ current_word ]
output["words"][cpt]["annotations"] = current_word_annotations
output["words"][cpt]["nb_annotations"] = len ( current_word_annotations )
@@ -508,7 +508,7 @@
"id":N( r["sajda_id"] ) if ( r["sajda"] == u"نعم" ) else None,
},
- "annotations": {} if not annotation_aya
+ "annotations": {} if not annotation_aya or not annotations_by_position.has_key( ( r["sura_id"], r["aya_id"] ) )
else annotations_by_position[( r["sura_id"], r["aya_id"] )]
}