Returns a list of client URNs associated with keywords.

    Args:
      keywords: The list of keywords to search by.

    Returns:
      A list of client URNs.

    Raises:
      ValueError: A string (single keyword) was passed instead of an iterable.
771562
def LookupClients(self, keywords):
    
    if isinstance(keywords, string_types):
      raise ValueError(
          "Keywords should be an iterable, not a string (got %s)." % keywords)

    start_time, filtered_keywords = self._AnalyzeKeywords(keywords)

    keyword_map = data_store.REL_DB.ListClientsForKeywords(
        list(map(self._NormalizeKeyword, filtered_keywords)),
        start_time=start_time)

    results = itervalues(keyword_map)
    relevant_set = set(next(results))

    for hits in results:
      relevant_set &= set(hits)

      if not relevant_set:
        return []

    return sorted(relevant_set)
586338
def extract_keywords_from_text(self, text):
        
        sentences = nltk.tokenize.sent_tokenize(text)
        self.extract_keywords_from_sentences(sentences)
715208
def keywords_market_by_keyword(kw_id, options={})
      response = connection.get do |req|
        req.url "insight/keywords/market/by/keywords/#{kw_id}", options
      end
      return_error_or_body(response)
    end
476309
def show_keyword_help(cur, arg):
    
    keyword = arg.strip('"').strip("'")
    query = "help '{0}'".format(keyword)
    log.debug(query)
    cur.execute(query)
    if cur.description and cur.rowcount > 0:
        headers = [x[0] for x in cur.description]
        return [(None, cur.fetchall(), headers, '')]
    else:
        return [(None, None, None, 'No help found for {0}.'.format(keyword))]
536614
def extract_keywords(cls, line, items):
        
        unprocessed = list(reversed(line.split('=')))
        while unprocessed:
            chunk = unprocessed.pop()
            key = None
            if chunk.strip() in cls.allowed:
                key = chunk.strip()
            else:
                raise SyntaxError("Invalid keyword: %s" % chunk.strip())
            # The next chunk may end in a subsequent keyword
            value = unprocessed.pop().strip()
            if len(unprocessed) != 0:
                # Check if a new keyword has begun
                for option in cls.allowed:
                    if value.endswith(option):
                        value = value[:-len(option)].strip()
                        unprocessed.append(option)
                        break
                else:
                    raise SyntaxError("Invalid keyword: %s" % value.split()[-1])
            keyword = '%s=%s' % (key, value)
            try:
                items.update(eval('dict(%s)' % keyword))
            except:
                raise SyntaxError("Could not evaluate keyword: %s" % keyword)
        return items
1158902
def ReadClientPostingLists(self, keywords):
    

    start_time, filtered_keywords = self._AnalyzeKeywords(keywords)

    return data_store.REL_DB.ListClientsForKeywords(
        filtered_keywords, start_time=start_time)
626372
def fetch_lists(keyword,max_results=20):
    
    #CONFIG FILE READ
    api_key=config.get('GOOGLE_CSE_KEYS','API_KEY')
    cse_id=config.get('GOOGLE_CSE_KEYS','CSE_ID')

    results = []
    start_c = 1
    search_term = "inurl:lists + "+keyword
    while len(results)<max_results:
        temp_res = google_search(search_term,api_key,cse_id,num=10,start=start_c)
        if len(temp_res) == 0:
            print("Google API Error, returning retrieved results")
            return results
        results.extend(temp_res)
        start_c += 10
    return results[:max_results]
334352
def keywords(self):
        
        return [x[0] for x in self.session.query(models.Keyword.name).all()]
113151
def getcolkeyword(self, columnname, keyword):
        
        if isinstance(keyword, str):
            return self._getkeyword(columnname, keyword, -1)
        else:
            return self._getkeyword(columnname, '', keyword)
3097
def get_settings_by_keyword(keyword=None):
    
    settings = []
    if keyword is None:
        # iterate over all the schemas to return all settings
        for key, ischemas in CONTROLPANEL_INTERFACE_MAPPING.items():
            settings_from_ifaces = map(get_settings_from_interface, ischemas)
            settings_from_key = {k: v for d in settings_from_ifaces for k, v in d.items()}
            settings.append({key: settings_from_key,
                             "api_url": url_for("senaite.jsonapi.v1.settings", key=key)})
        return settings
    # if keyword has value then get only the settings associated to the key
    settings_from_ifaces = map(get_settings_from_interface, CONTROLPANEL_INTERFACE_MAPPING[keyword])
    settings_from_key = {k: v for d in settings_from_ifaces for k, v in d.items()}
    settings.append({keyword: settings_from_key,
                     "api_url": url_for("senaite.jsonapi.v1.settings", key=keyword)})
    return settings
105935
def AddClientKeywords(self, client_id, keywords, cursor=None):
    """"""
    cid = db_utils.ClientIDToInt(client_id)
    keywords = set(keywords)
    args = [(cid, mysql_utils.Hash(kw), kw) for kw in keywords]
    args = list(collection.Flatten(args))

    query = """
        INSERT INTO client_keywords (client_id, keyword_hash, keyword)
        VALUES {}
        ON DUPLICATE KEY UPDATE timestamp = NOW(6)
            """.format(", ".join(["(%s, %s, %s)"] * len(keywords)))
    try:
      cursor.execute(query, args)
    except MySQLdb.IntegrityError as e:
      raise db.UnknownClientError(client_id, cause=e)
1001920
def __get_keywords(self):
        
        txt = self.text
        for line in txt:
            for word in split_words(line):
                yield(word)
637197
def full_keywords(soup):
    ""
    if not raw_parser.author_keywords(soup):
        return []
    return list(map(node_contents_str, raw_parser.author_keywords(soup)))
942497
def search(self, keyword, children=None, arg=None):
        
        if children is None:
            children = self.substmts
        return [ ch for ch in children
                 if (ch.keyword == keyword and
                     (arg is None or ch.arg == arg))]
192493
def postprocess_keywordsPlus(self, entry):
        

        if type(entry.keywordsPlus) in [str, unicode]:
            entry.keywordsPlus = [k.strip().upper() for k
                                  in entry.keywordsPlus.split(';')]
690941
def list_keywords(self):
        '''  '''
        names = []
        try:
            for n in self.cur.execute("SELECT keyword FROM keyword;").fetchall():
                # Strip out leading and trailing whitespaces (can be artifacts of old data)
                k = n[0].strip()
                if len(k):
                    names.extend([k])
        except:
            self.error("ERROR: cannot find database table 'keyword'")
        names = list(set(names)) # remove duplicates
        names = sorted(names, key=lambda s: s.lower())
        return(names)
56045
def keywords(self):
        
        dataset = [
            self.aleph_kw_handler.keywords,
            self.user_kw_handler.keywords,
            self.analysis_kw_handler.keywords,
        ]

        return sum(dataset, [])