← Back to team overview

team4alfanous team mailing list archive

[Branch ~team4alfanous/alfanous/alfanous-git] Rev 457: Fix a problem in derivation search, fixes 45

 

------------------------------------------------------------
revno: 457
committer: Assem Chelli <assem.ch@xxxxxxxxx>
timestamp: Sat 2012-12-22 00:59:38 +0100
message:
  Fix a problem in derivation search, fixes 45
  the case of words not in the index 
   
  for example: >>الأمل
   
modified:
  src/alfanous/QueryProcessing.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/QueryProcessing.py'
--- src/alfanous/QueryProcessing.py	2012-10-16 07:05:36 +0000
+++ src/alfanous/QueryProcessing.py	2012-12-21 23:59:38 +0000
@@ -580,7 +580,7 @@
             if word in derivedict["word_"]: indexsrc = "word_"
             elif word in derivedict["lemma"]: indexsrc = "lemma"
             elif word in derivedict["root"]: indexsrc = "root"
-            else: indexsrc = "none" #warning
+            else: indexsrc = None #warning
             #define destination level index
             if leveldist == 0: indexdist = "word_"
             elif leveldist == 1: indexdist = "lemma"
@@ -592,10 +592,12 @@
             Find = lambda source, dist, itm: [dist[i] for i in [i for i in range( len( source ) ) if source[i] == itm]]
 
             lst = []
-            if indexsrc != "none":
+            if indexsrc: #if index source level is definded
                 itm = locate( derivedict[indexsrc], derivedict[indexdist], word )
-                #print itm
-                lst = filter_doubles( Find( derivedict[indexdist], derivedict["word_"], itm ) )
+                if itm: # if different of none
+                    lst = filter_doubles( Find( derivedict[indexdist], derivedict["word_"], itm ) )
+                else:
+                    lst=[word]
 
             return lst