team4alfanous team mailing list archive
-
team4alfanous team
-
Mailing list archive
-
Message #00353
[Branch ~team4alfanous/alfanous/alfanous-git] Rev 542: show synonyms and derivations in the API and WUI results
------------------------------------------------------------
revno: 542
committer: Assem Chelli <assem.ch@xxxxxxxxx>
timestamp: Sun 2013-01-20 15:45:50 +0100
message:
show synonyms and derivations in the API and WUI results
modified:
src/alfanous-django/templates/aya_results.html
src/alfanous-django/wui/static/css/screen.css
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-django/templates/aya_results.html'
--- src/alfanous-django/templates/aya_results.html 2013-01-09 19:48:08 +0000
+++ src/alfanous-django/templates/aya_results.html 2013-01-20 14:45:50 +0000
@@ -54,16 +54,35 @@
<span style=' font-size:14pt; color:#00aa00;'> {{ wordcpt }}. </span>
<a class='no_decoration' href="?{% build_search_link params wordstat.word 1 False %}">
<div class='details_label word_info0 clickable'> {{ _("word") }} | {{ wordstat.word }} {% if wordstat.romanization %} ( {{ wordstat.romanization }} ) {% endif %} </div></a>
- <div class='details_label word_stat0'> {{ _("occurnaces") }} | {{ wordstat.nb_matches }} </div>
+ <div class='details_label word_stat0'> {{ _("occurances") }} | {{ wordstat.nb_matches }} </div>
<div class='details_label word_stat1'> {{ _("ayates") }} | {{ wordstat.nb_ayas }} </div>
+
+ <br />
<div class='details_label word_vocalization_nb'> {{ _("vocalizations") }} | {{ wordstat.nb_vocalizations }} </div>
-
- {% for vocalization in wordstat.vocalizations %}
- {% with bidi.fields.aya_|add:":"|add:vocalization|add:"" as new_query %}
- <a class='no_decoration' href="?{% build_search_link params new_query 1 False %}">
- {% endwith %}
- <div class='details_label word_vocalization clickable quran'> {{ vocalization }} </div></a>
- {% endfor %}
+ {% for vocalization in wordstat.vocalizations %}
+ {% with bidi.fields.aya_|add:":"|add:vocalization|add:"" as new_query %}
+ <a class='no_decoration' href="?{% build_search_link params new_query 1 False %}">
+ {% endwith %}
+ <div class='details_label word_vocalization clickable quran'> {{ vocalization }} </div></a>
+ {% endfor %}
+
+ {% ifnotequal wordstat.nb_synonyms 0 %}
+ <br />
+ <div class='details_label word_synonym_nb'> {{ _("synonyms") }} | {{ wordstat.nb_synonyms }} </div>
+ {% for synonym in wordstat.synonyms %}
+ <a class='no_decoration' href="?{% build_search_link params synonym 1 False %}">
+ <div class='details_label word_synonym clickable quran'> {{ synonym }} </div></a>
+ {% endfor %}
+ {% with "~"|add:wordstat.word as new_query %}
+ <a class='no_decoration' href="?{% build_search_link params new_query 1 False %}">
+ {% endwith %}
+ <div class='details_label word_synonym clickable quran'> {{ _("ALL") }} | ~{{ wordstat.word }} </div></a>
+ {% endifnotequal %}
+
+
+ <br />
+ <div class='details_label word_derivation_nb'> {{ _("derivations") }} | {{ wordstat.nb_derivations }} </div>
+
{% for annotation_word, parts in wordstat.annotations.items %}
{% for part_order, annotation_detail in parts.items %}
<p class='annotation_details'>
@@ -141,7 +160,7 @@
{% for ayaresult_id, ayaresult_content in results.search.ayas.items %}
<fieldset class='main_re_item'>
<legend class='main_re_item_title' style='font-size:14pt; ' dir='{{ bidi.direction }}'>
- <span align='left' style='color:#0000ff;'>
+ <span align='left' epstyle='color:#0000ff;'>
{{ _("Result n°") }} <b> {{ ayaresult_id }} </b>
</span>
{% if ayaresult_content.aya.recitation %}
=== modified file 'src/alfanous-django/wui/static/css/screen.css'
--- src/alfanous-django/wui/static/css/screen.css 2013-01-07 22:43:30 +0000
+++ src/alfanous-django/wui/static/css/screen.css 2013-01-20 14:45:50 +0000
@@ -534,6 +534,26 @@
padding: 5px 2px 4px 2px;
/* font-size:100%;*/
}
+
+.word_synonym_nb {
+ background-color: #09A;
+ color: #FFF;
+}
+
+.word_synonym {
+ background-color: #FFF;
+ color: #09A;
+ padding: 5px 2px 4px 2px;
+ /* font-size:100%;*/
+}
+
+.word_derivation_nb {
+ background-color: #A90;
+ color: #FFF;
+}
+
+
+
.word_annotation_nb {
background-color: #0A9;
color: #FFF;
=== modified file 'src/alfanous/Outputs.py'
--- src/alfanous/Outputs.py 2013-01-09 00:32:17 +0000
+++ src/alfanous/Outputs.py 2013-01-20 14:45:50 +0000
@@ -39,6 +39,8 @@
from alfanous.dynamic_resources.arabicnames_dyn import ara2eng_names as Fields
from alfanous.dynamic_resources.std2uth_dyn import std2uth_words
from alfanous.dynamic_resources.vocalizations_dyn import vocalization_dict
+from alfanous.dynamic_resources.synonymes_dyn import syndict
+from alfanous.dynamic_resources.derivations_dyn import derivedict
from alfanous.TextProcessing import QArabicSymbolsFilter
from alfanous.Data import *
from alfanous.Misc import buck2uni
@@ -579,13 +581,21 @@
vocalizations = vocalization_dict[term[1]] if vocalization_dict.has_key( term[1] ) \
else []
nb_vocalizations_globale += len( vocalizations )
+ synonyms = syndict[term[1]] if syndict.has_key( term[1] ) \
+ else []
+ derivations = derivedict[term[1]] if derivedict.has_key( term[1] ) \
+ else []
words_output[ "individual" ][ cpt ] = {
- "word":term[1],
- "romanization": buck2uni( term[1], ignore = "" , reverse = True ) if romanization == "buckwalter" else None,
- "nb_matches":term[2],
- "nb_ayas":term[3],
- "nb_vocalizations": len( vocalizations ),
- "vocalizations": vocalizations
+ "word":term[1],
+ "romanization": buck2uni( term[1], ignore = "" , reverse = True ) if romanization == "buckwalter" else None,
+ "nb_matches":term[2],
+ "nb_ayas":term[3],
+ "nb_vocalizations": len( vocalizations ),
+ "vocalizations": vocalizations,
+ "nb_synonyms": len( synonyms ),
+ "synonyms": synonyms,
+ "nb_derivations": len( derivations ),
+ "derivations": derivations
}
cpt += 1
annotation_word_query += u" ) "