Prepare a string.
550491
final public StringWrapper prepare(String s) {
		MultiStringWrapper ms = new MultiStringWrapper(s,delim);
		if (!isLegalMultiStringWrapperSize(ms.size())) {
			throw new IllegalArgumentException("string has invalid number of fields");
		}
		for (int i=0; i<ms.size(); i++) {
			ms.set(i, getDistance(i).prepare( ms.get(i).unwrap() ));
		}
		return ms;
	}
952111
final public StringWrapper prepare(String s) {
		BagOfTokens bag = new BagOfTokens(s, tokenizer.tokenize(s));
		double totalWeight = bag.getTotalWeight();
		for (Iterator i=bag.tokenIterator(); i.hasNext(); ) {
			Token tok = (Token)i.next();
			double freq = bag.getWeight(tok);
			bag.setWeight( tok, smoothedProbability(tok, freq, totalWeight) );
		}
		return bag;
	}
721716
private void setString(String s) {
        _string.setLength(0);
        _string.append(s);
        _length = s.length();
    }
1089848
public void putShortString(String value)
    {
        checkAvailable(value.length() + 1);
        Wire.putShortString(needle, value);
    }
521984
def get_string_from_data(self, offset, data):
        """"""
        
        # OC Patch
        b = None
        
        try:
            b = data[offset]
        except IndexError:
            return ''
        
        s = ''
        while ord(b):
            s += b
            offset += 1
            try:
                b = data[offset]
            except IndexError:
                break
        
        return s
153136
def Escape(self, string="", **_):
    """"""
    # Translate special escapes:
    self.stack[-1] += self.STRING_ESCAPES.get(string, string)
457812
def do_string_set(self, element, decl, pseudo):
        """"""
        args = serialize(decl.value)
        step = self.state[self.state['current_step']]

        strval = ''
        strname = None
        for term in decl.value:
            if type(term) is ast.WhitespaceToken:
                continue

            elif type(term) is ast.StringToken:
                if strname is not None:
                    strval += term.value
                else:
                    log(WARN, u"Bad string-set: {}".format(
                        args).encode('utf-8'))

            elif type(term) is ast.IdentToken:
                if strname is not None:
                    log(WARN, u"Bad string-set: {}".format(
                        args).encode('utf-8'))
                else:
                    strname = term.value

            elif type(term) is ast.LiteralToken:
                if strname is None:
                    log(WARN, u"Bad string-set: {}".format(
                        args).encode('utf-8'))
                else:
                    step['strings'][strname] = strval
                    strval = ''
                    strname = None

            elif type(term) is ast.FunctionBlock:
                if term.name == 'string':
                    str_args = split(term.arguments, ',')
                    str_name = self.eval_string_value(element,
                                                      str_args[0])[0]
                    val = self.lookup('strings', str_name)
                    if val == '':
                        if len(str_args) > 1:
                            val = self.eval_string_value(element,
                                                         str_args[1])[0]
                        else:
                            log(WARN, u"{} blank string"
                                .format(str_name).encode('utf-8'))

                    if strname is not None:
                        strval += val
                    else:
                        log(WARN, u"Bad string-set: {}".format(
                            args).encode('utf-8'))

                elif term.name == 'counter':
                    counterargs = [serialize(t).strip(" \'")
                                   for t in split(term.arguments, ',')]
                    count = self.lookup('counters', counterargs)
                    strval += str(count)

                elif term.name == u'attr':
                    if strname is not None:
                        att_args = split(term.arguments, ',')
                        att_name = self.eval_string_value(element,
                                                          att_args[0])[0]
                        att_def = ''
                        if len(att_args) > 1:
                            att_def = self.eval_string_value(element,
                                                             att_args[1])[0]
                        if '|' in att_name:
                            ns, att = att_name.split('|')
                            try:
                                ns = self.css_namespaces[ns]
                            except KeyError:
                                log(WARN, u"Undefined namespace prefix {}"
                                    .format(ns).encode('utf-8'))
                                continue
                            att_name = etree.QName(ns, att)
                        strval += element.etree_element.get(att_name, att_def)
                    else:
                        log(WARN, u"Bad string-set: {}".format(
                            args).encode('utf-8'))

                elif term.name == u'content':
                    if strname is not None:
                        strval += etree.tostring(element.etree_element,
                                                 encoding='unicode',
                                                 method='text',
                                                 with_tail=False)
                    else:
                        log(WARN, u"Bad string-set: {}".format(
                            args).encode('utf-8'))

                elif term.name == u'first-letter':
                    tmpstr = self.eval_string_value(element, term.arguments)
                    if tmpstr:
                        if isinstance(tmpstr[0], basestring):
                            strval += tmpstr[0][0]
                        else:
                            log(WARN, u"Bad string value:"
                                u" nested target-* not allowed. "
                                u"{}".format(serialize(
                                    args)).encode('utf-8'))

                elif term.name == u'pending':
                    log(WARN, u"Bad string-set:pending() not allowed. {}"
                        .format(args).encode('utf-8'))

        if strname is not None:
            step['strings'][strname] = strval
221149
def from_string(cls, id, format, raw_content, compressed=False,
                    encoded=False):
        """"""
        content = cls(id, format, compressed, encoded)
        content._raw_content = raw_content
        return content
681696
def from_string(cls, string):
        
        cls.TYPE.setParseAction(cls.make)
        try:
            return cls.TYPE.parseString(string, parseAll=True)[0]
        except ParseException:
            log.error("Failed to parse '{0}'".format(string))
            raise
198832
def _pad_string(self, str, colwidth):
        """"""
        width = self._disp_width(str)
        prefix = (colwidth - 1 - width) // 2
        suffix = colwidth - prefix - width
        return ' ' * prefix + str + ' ' * suffix
1161497
function prepareString(role: string): string {
  return JSON.stringify(role).replace(/"/g, "'").replace(/,/g, ', ');
}
401468
def prepare(data):
    """"""
    message = data.get("message")
    sha = data.get("sha")
    tree = data.get("tree")
    tree_sha = tree.get("sha")
    return {"message": message, "sha": sha, "tree": {"sha": tree_sha}}
121087
def from_string(cls, s):
        """"""
        stream = cStringIO(s)
        stream.seek(0)
        return cls(**yaml.safe_load(stream))
38908
def write(self, string):
        """"""
        self._output += self._options.indentation_character * \
            self._indentation + string + '\n'
487840
def prepare_string(partname, thread, maxw):
    
    # map part names to function extracting content string and custom shortener
    prep = {
        'mailcount': (prepare_mailcount_string, None),
        'date': (prepare_date_string, None),
        'authors': (prepare_authors_string, shorten_author_string),
        'subject': (prepare_subject_string, None),
        'content': (prepare_content_string, None),
    }

    s = ' '  # fallback value
    if thread:
        # get extractor and shortener
        content, shortener = prep[partname]

        # get string
        s = content(thread)

    # sanitize
    s = s.replace('\n', ' ')
    s = s.replace('\r', '')

    # shorten if max width is requested
    if maxw:
        if len(s) > maxw and shortener:
            s = shortener(s, maxw)
        else:
            s = s[:maxw]
    return s
15895
private static String preparePlaceHolders(int length) {
        StringBuilder builder = new StringBuilder();
        for (int i = 0; i < length; ) {
            builder.append("?");
            if (++i < length) {
                builder.append(",");
            }
        }
        return builder.toString();
    }
457407
def prepare(cls, value):
        """"""
        pfield = struct.pack('b', cls.type_code)
        if isinstance(value, string_types):
            value = datetime.datetime.strptime(value, "%Y-%m-%d")
        year = value.year | 0x8000  # for some unknown reasons year has to be bit-or'ed with 0x8000
        month = value.month - 1     # for some unknown reasons HANA counts months starting from zero
        pfield += cls._struct.pack(year, month, value.day)
        return pfield