Exemple #1
0
def attr_vals(corpname, avattr, avpattern, avmaxitems=20):
    attr = manatee.findPosAttr(corpname, avattr)
    gen = attr.regexp2ids(".*%s.*" % avpattern.strip(), True)
    items = []
    while not gen.end() and avmaxitems > 0:
        items.append(attr.id2str(gen.next()))
        avmaxitems -= 1
    if not items:
        return "{query:'%s',suggestions:['%s']}" % (avpattern, "--nothing found--")
    return "{query:'%s',suggestions:[%s]}" % (avpattern, ",".join(["'" + item + "'" for item in items]))
Exemple #2
0
def attr_vals(corpname, avattr, avpattern, avmaxitems=20):
    attr = manatee.findPosAttr(corpname, avattr)
    gen = attr.regexp2ids('.*%s.*' % avpattern.strip(), True)
    items = []
    while not gen.end() and avmaxitems > 0:
        items.append(attr.id2str(gen.next()))
        avmaxitems -= 1
    if not items:
        return "{query:'%s',suggestions:['%s']}" % (avpattern,
                                                    '--nothing found--')
    return "{query:'%s',suggestions:[%s]}" % \
           (avpattern, ','.join(["'" + item + "'" for item in items]))
Exemple #3
0
 def findPosAttr(self, corpname, attrname):
     return manatee.findPosAttr(corpname.split(':', 1)[0], attrname)
Exemple #4
0
 def findPosAttr(self, corpname: str, attrname: str) -> PosAttr:
     return manatee.findPosAttr(corpname.split(':', 1)[0], attrname)
Exemple #5
0
 def findPosAttr(self, corpname, attrname):
     return manatee.findPosAttr(corpname.split(":", 1)[0], attrname)