Adds the given Unicode text as a locally defined symbol.
320556
def __add_text(self, text):
        """"""
        if text is not None and not isinstance(text, six.text_type):
            raise TypeError('Local symbol definition must be a Unicode sequence or None: %r' % text)
        sid = self.__new_sid()
        location = None
        if self.table_type.is_shared:
            location = self.__import_location(sid)
        token = SymbolToken(text, sid, location)
        self.__add(token)
        return token
526975
public static void append(Path self, Object text) throws IOException {
        append(self, text, Charset.defaultCharset().name(), false);
    }
312079
def encode (text):
    """"""
    if isinstance(text, unicode):
        return text.encode(i18n.default_encoding, 'ignore')
    return text
570540
def prettify(unicode_text):
    
    import xml.dom.minidom
    reparsed = xml.dom.minidom.parseString(unicode_text.encode('utf-8'))
    return reparsed.toprettyxml(indent="  ", newl="\n")
289737
def add_to_dict(self, text):
        
        n = self.n

        sentences = re.split(r'(?<!\w\.\w.)(?<![A-Z][a-z]\.)(?<=\.|\?|!)\s', text)
        # '' is a special symbol for the start of a sentence like pymarkovchain uses
        for sentence in sentences:
            sentence = sentence.replace('"','') # remove quotes
            words = sentence.strip().split()  # split each sentence into its constituent words
            if len(words) == 0:
                continue

            # first word follows a sentence end
            self.word_dict[("",)][words[0]].count += 1

            for j in range(1, n+1):
                for i in range(len(words) - 1):
                    if i + j >= len(words):
                        continue
                    word = tuple(words[i:i + j])
                    self.word_dict[word][words[i + j]].count += 1

                # last word precedes a sentence end
                self.word_dict[tuple(words[len(words) - j:len(words)])][""].count += 1

        # We've now got the db filled with parametrized word counts
        # We still need to normalize this to represent probabilities
        for word in self.word_dict:
            wordsum = 0
            for nextword in self.word_dict[word]:
                wordsum += self.word_dict[word][nextword].count
            if wordsum != 0:
                for nextword in self.word_dict[word]:
                    self.word_dict[word][nextword].prob = self.word_dict[word][nextword].count / wordsum
138135
def __add_import(self, original_token):
        """"""
        sid = self.__new_sid()
        token = SymbolToken(original_token.text, sid, original_token.location)
        self.__add(token)
        return token
1117922
@Override
    public void addMatchSetTo(UnicodeSet toUnionTo) {
        int ch;
        for (int i=0; i<pattern.length(); i+=UTF16.getCharCount(ch)) {
            ch = UTF16.charAt(pattern, i);
            UnicodeMatcher matcher = data.lookupMatcher(ch);
            if (matcher == null) {
                toUnionTo.add(ch);
            } else {
                matcher.addMatchSetTo(toUnionTo);
            }
        }
    }
187910
@Override
    public void addSourceTargetSet(UnicodeSet inputFilter, UnicodeSet sourceSet, UnicodeSet targetSet) {
        synchronized (this) {
            if (sourceTargetUtility == null) {
                sourceTargetUtility = new SourceTargetUtility(new Transform<String,String>() {
                    @Override
                    public String transform(String source) {
                        return UCharacter.toUpperCase(locale, source);
                    }
                });
            }
        }
        sourceTargetUtility.addSourceTargetSet(this, inputFilter, sourceSet, targetSet);
    }
1257791
def adds(self, string):
        
        if isinstance(string, unicode):
            string = string.encode("utf-8")

        self.children.append((STRING, str(string)))
923141
public void addText(String text) {
        try {
            writer.append(text);
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
461231
def add_md(text, s, level=0):
    """"""
    if level > 0:
        if text != "":
            text += "\n"
        text += "#" * level
        text += " "

    text += s + "\n"

    if level > 0:
        text += "\n"

    return text
673906
public void setAsText(String text) throws IllegalArgumentException {
		for (int i = 0; i < length; i++)
			if (text.equals(locales[i].getDisplayName())) {
				locale = locales[i];
				setValue(locale);

				break;
			}
	}
120608
public final UnicodeSet addAll(CharSequence s) {
        checkFrozen();
        int cp;
        for (int i = 0; i < s.length(); i += UTF16.getCharCount(cp)) {
            cp = UTF16.charAt(s, i);
            add_unchecked(cp, cp);
        }
        return this;
    }
476641
def __add_shared(self, original_token):
        """"""
        sid = self.__new_sid()
        token = SymbolToken(original_token.text, sid, self.__import_location(sid))
        self.__add(token)
        return token
968088
def any2unicode(text, encoding='utf8', errors='strict'):
    """"""
    if isinstance(text, unicode):
        return text
    return unicode(text, encoding, errors=errors)
1200921
@SafeVarargs
    public final WordBuilder<I> append(I... symbols) {
        if (symbols.length == 0) {
            return this;
        }
        ensureAdditionalCapacity(symbols.length);
        System.arraycopy(symbols, 0, array, length, symbols.length);
        length += symbols.length;
        return this;
    }
995390
public TextTrieMap<V> put(CharSequence text, V val) {
        CharIterator chitr = new CharIterator(text, 0, _ignoreCase);
        _root.add(chitr, val);
        return this;
    }