Parse WoS "Keyword Plus" keywords.

        Keyword Plus keywords are usually semicolon-delimited.
192493
def postprocess_keywordsPlus(self, entry):
        

        if type(entry.keywordsPlus) in [str, unicode]:
            entry.keywordsPlus = [k.strip().upper() for k
                                  in entry.keywordsPlus.split(';')]
995943
function defineKeywords(ajv, keyword) {
  if (Array.isArray(keyword)) {
    for (var i=0; i<keyword.length; i++)
      get(keyword[i])(ajv);
    return ajv;
  }
  if (keyword) {
    get(keyword)(ajv);
    return ajv;
  }
  for (keyword in KEYWORDS) get(keyword)(ajv);
  return ajv;
}
388622
def _remove_keywords(d):
    
    return { k:v for k, v in iteritems(d) if k not in RESERVED }
1164207
def parse(cls, parser, text, pos):
        """"""
        match = cls.regex.match(text)
        if match:
            # Check if match is is not in the grammar of the specific keyword class.
            if match.group(0).lower() not in cls.grammar:
                result = text, SyntaxError(repr(match.group(0)) + " is not a member of " + repr(cls.grammar))
            else:
                result = text[len(match.group(0)):], cls(match.group(0))
        else:
            result = text, SyntaxError("expecting " + repr(cls.__name__))
        return result
253241
def set_keywords(self, keywords):
        
        self._query_params += str(QueryParam.KEYWORDS) + '+'.join(keywords)
1155502
def visit_keyword(self, node):
        """"""
        if node.arg is None:
            return "**%s" % node.value.accept(self)
        return "%s=%s" % (node.arg, node.value.accept(self))
80542
def keyword_to_key(word,alphabet='ABCDEFGHIJKLMNOPQRSTUVWXYZ'):
    ''' 
    '''
    ret = ''
    word = (word + alphabet).upper()
    for i in word:
        if i in ret: continue
        ret += i
    return ret
1353015
def keywords(s, top=10, **kwargs):
    
    return parser.find_keywords(s, top=top, frequency=parser.frequency)
6765
def _get_keywords(self, **kwargs):
        """"""
        if self.jurisdiction and 'jurisdiction_id' not in kwargs:
            kwargs['jurisdiction_id'] = self.jurisdiction
        if 'count' in kwargs:
            kwargs['page_size'] = kwargs.pop('count')
        if 'start' in kwargs:
            start = kwargs.pop('start')
            if 'end' in kwargs:
                end = kwargs.pop('end')
            else:
                end = date.today().strftime('%m-%d-%Y')
            start, end = self._format_dates(start, end)
            kwargs['start_date'] = start
            kwargs['end_date'] = end
        elif 'between' in kwargs:
            start, end = kwargs.pop('between')
            start, end = self._format_dates(start, end)
            kwargs['start_date'] = start
            kwargs['end_date'] = end
        return kwargs
358926
function matchKeyword(keyword) {
        var token = lookahead();
        return token.type === Token.Keyword && token.value === keyword;
    }
67317
def find_keyword_in_context(tokens, keyword, contextsize=1):
    """"""
    if isinstance(keyword,tuple) and isinstance(keyword,list):
        l = len(keyword)
    else:
        keyword = (keyword,)
        l = 1
    n = l + contextsize*2
    focuspos = contextsize + 1
    for ngram in Windower(tokens,n,None,None):
        if ngram[focuspos:focuspos+l] == keyword:
            yield ngram[:focuspos], ngram[focuspos:focuspos+l],ngram[focuspos+l+1:]
400705
def builtin(self, keyword):
        """"""
        # The match includes the lparen token, so the keyword is just the first
        # token in the match, not the whole thing.
        keyword_start = self.tokens.matched.first.start
        keyword_end = self.tokens.matched.first.end
        self.tokens.expect(common_grammar.lparen)

        if self.tokens.matched.start != keyword_end:
            return self.error(
                "No whitespace allowed between function and lparen.",
                start_token=self.tokens.matched.first)

        expr_type = grammar.BUILTINS[keyword.lower()]
        arguments = [self.expression()]
        while self.tokens.accept(common_grammar.comma):
            arguments.append(self.expression())

        self.tokens.expect(common_grammar.rparen)

        if expr_type.arity and expr_type.arity != len(arguments):
            return self.error(
                "%s expects %d arguments, but was passed %d." % (
                    keyword, expr_type.arity, len(arguments)),
                start_token=self.tokens.matched.first)

        return expr_type(*arguments, start=keyword_start,
                         end=self.tokens.matched.end, source=self.original)
944000
def get_extra_keywords(self):
        """"""
        extra_keywords = {}
        for key, widgets in list(self.widgets_dict.items()):
            if widgets[0].isChecked():
                if isinstance(widgets[1], QLineEdit):
                    extra_keywords[key] = widgets[1].text()
                elif isinstance(widgets[1], QComboBox):
                    current_index = widgets[1].currentIndex()
                    extra_keywords[key] = widgets[1].itemData(current_index)
                elif isinstance(widgets[1], (QDoubleSpinBox, QSpinBox)):
                    extra_keywords[key] = widgets[1].value()
                elif isinstance(widgets[1], QDateTimeEdit):
                    extra_keywords[key] = widgets[1].dateTime().toString(
                        Qt.ISODate)

        return extra_keywords
4202
def translate_keyword_tokens( token )
      keywords = ["__LINE__", "__ENCODING__", "__FILE__", "BEGIN",   
                  "END", "alias", "and", "begin", "break", "case",
                  "class", "def", "defined?", "do", "else", "elsif",
                  "end", "ensure", "false", "for", "if", "in",
                  "module", "next", "nil", "not", "or", "redo",
                  "rescue", "retry", "return", "self", "super",
                  "then", "true", "undef", "unless", "until", 
                  "when", "while", "yield"]
      if keywords.include?( token.content )
        token.type = token.content.downcase.to_sym
        # Change the state if we match a keyword
        @expr_state = :beg
      end
      
      # A couple of exceptions      
      if token.content == "BEGIN"
        token.type = :begin_global 
        @expr_state = :beg
      elsif token.content == "END"
        token.type = :end_global 
        @expr_state = :beg
      end
      
      token
    end
1061614
def _format_results(_keywords, combined_keywords, split, scores):
    
    combined_keywords.sort(key=lambda w: _get_average_score(w, _keywords), reverse=True)
    if scores:
        return [(word, _get_average_score(word, _keywords)) for word in combined_keywords]
    if split:
        return combined_keywords
    return "\n".join(combined_keywords)
1051570
def get_keywords(lexer):
    
    if not hasattr(lexer, 'tokens'):
        return []
    if 'keywords' in lexer.tokens:
        try:
            return lexer.tokens['keywords'][0][0].words
        except:
            pass
    keywords = []
    for vals in lexer.tokens.values():
        for val in vals:
            try:
                if isinstance(val[0], words):
                    keywords.extend(val[0].words)
                else:
                    ini_val = val[0]
                    if ')\\b' in val[0] or ')(\\s+)' in val[0]:
                        val = re.sub(r'\\.', '', val[0])
                        val = re.sub(r'[^0-9a-zA-Z|]+', '', val)
                        if '|' in ini_val:
                            keywords.extend(val.split('|'))
                        else:
                            keywords.append(val)
            except Exception:
                continue
    return keywords
637684
function surroundKeywords(keywords, text, prefix, suffix) {
	if (!keywords.length) return text;

	let regexString = keywords.map((k) => {
		if (k.type === 'regex') {
			return stringUtilsCommon.replaceRegexDiacritics(k.valueRegex);
		} else {
			const value = typeof k === 'string' ? k : k.value;
			return stringUtilsCommon.replaceRegexDiacritics(stringUtilsCommon.pregQuote(value));
		}
	}).join('|');
	regexString = '(' + regexString + ')'
	const re = new RegExp(regexString, 'gi');
	return text.replace(re, prefix + '$1' + suffix);
}