Exemplo n.º 1
0
 def annotate(self, dictionary, startmark, endmark):
     result = dictionary.copy()
     value = self.word
     for a in dictionary:
         L = dictionary.get(a)
         # pr "<hr>   a,L =", (a,L), "<hr>"
         result[a] = [delimitMatches(v, value, startmark, endmark) for v in L]
     return result
Exemplo n.º 2
0
 def annotate(self, dictionary, startmark, endmark):
     result = dictionary.copy()
     attr = self.attr
     value = self.word
     L = dictionary.get(self.attr)
     if L:
         result[attr] = [delimitMatches(v, value, startmark, endmark) for v in L]
     return result
Exemplo n.º 3
0
 def annotate(self, dictionary, startmark, endmark):
     "from a dictionary representation for an entry, generate a new dictionary with annotations added at matches for self"
     result = dictionary.copy()
     attr = self.attr
     value = self.value
     L = dictionary.get(attr)
     if L:
         result[attr] = [delimitMatches(v, value, startmark, endmark) for v in L]
     return result
Exemplo n.º 4
0
 def annotate(self, dictionary, startmark, endmark):
     result = dictionary.copy()
     attr = self.attr
     low = self.low
     high = self.high
     L = dictionary.get(attr)
     if L:
         L2 = []
         for v in L:
             if v >= low and v <= high:
                 L2.append(delimitMatches(str(v), str(v), startmark, endmark))
             else:
                 L2.append(v)
         result[attr] = L2
     return result