/*
a convenience mentod to get all strings as a sentence or phrase.
@since 1.1
174822
public String getString(String ...keys) {
        StringBuilder sb = new StringBuilder();
        for(String key:keys){
            sb.append(getString(key));
            sb.append(" ");
        }
        return sb.toString();
    }
417329
public static function getAllStrings()
    {
        if (is_null(self::$dir) || is_null(self::$locale)) {
            throw new \Exception('Locales directory and locale must be set');
        }

        $strings = [];
        foreach (scandir(self::$dir . '/' . self::$locale) as $text_domain) {
            if ($text_domain == '.' || $text_domain == '..') {
                continue;
            }

            /** @noinspection PhpIncludeInspection */
            foreach ((array)require self::$dir . '/' . self::$locale . '/' . $text_domain as $string => $value) {
                $strings[$string] = $value;
            }
        }

        return $strings;
    }
323913
private String getSentenceFromTokens(final String[] tokens) {
    final StringBuilder sb = new StringBuilder();
    for (final String token : tokens) {
      sb.append(token).append(" ");
    }
    final String sentence = sb.toString();
    return sentence;
  }
540160
public synchronized String getText() {
        StringBuilder bob = new StringBuilder(lines.get(0));
        for(int i = 1; i < lines.size(); i++) {
            bob.append("\n").append(lines.get(i));
        }
        return bob.toString();
    }
662251
public List<String> phraseDel(String[] words){
		List<String> list = new ArrayList<String>(); 
		String s;
		int length= words.length;
		for(int i = 0; i < length; i++){
			s = words[i];
			if(!isStopWord(s))
				list.add(s);
		}
		return list;
	}
501734
@Override
	public String getParagraphs(int min, int max) {
		int count = getCount(min, max);
		StringBuilder sb = new StringBuilder();
		for (int j = 0; j < count; j++) {
			int sentences = random.nextInt(5) + 2; // 2 to 6
			for (int i = 0; i < sentences; i++) {
				String first = getWords(1, 1, false);
				first = first.substring(0, 1).toUpperCase()
						+ first.substring(1);
				sb.append(first);

				sb.append(getWords(2, 20, false));
				sb.append(".  ");
			}
			sb.append("\n");
		}
		return sb.toString().trim();
	}
43818
private String[] getWords() {

        StringTokenizer tokenizer =
            new StringTokenizer(fSearchWords.getText());
        String[] result = new String[tokenizer.countTokens()];
        int      i      = 0;

        while (tokenizer.hasMoreTokens()) {
            result[i++] = tokenizer.nextToken();
        }    // end of while ((tokenizer.hasMoreTokens()))

        return result;
    }
703954
def phrases_map(data):
  """"""
  (entry, text_fn) = data
  text = text_fn()
  filename = entry.filename

  logging.debug("Got %s", filename)
  for s in split_into_sentences(text):
    words = split_into_words(s.lower())
    if len(words) < PHRASE_LENGTH:
      yield (":".join(words), filename)
      continue
    for i in range(0, len(words) - PHRASE_LENGTH):
      yield (":".join(words[i:i+PHRASE_LENGTH]), filename)
363660
function tokenize(str, wordRegexDelimiters, phraseRegexDelimiters) {
    if (wordRegexDelimiters === void 0) { wordRegexDelimiters = ' '; }
    if (phraseRegexDelimiters === void 0) { phraseRegexDelimiters = ''; }
    /* tslint:enable */
    var regexStr = '(?:[' + phraseRegexDelimiters + '])([^' + phraseRegexDelimiters + ']+)(?:[' + phraseRegexDelimiters + '])|([^' + wordRegexDelimiters + ']+)';
    var preTokenized = str.split(new RegExp(regexStr, 'g'));
    var result = [];
    var preTokenizedLength = preTokenized.length;
    var token;
    var replacePhraseDelimiters = new RegExp('[' + phraseRegexDelimiters + ']+', 'g');
    for (var i = 0; i < preTokenizedLength; i += 1) {
        token = preTokenized[i];
        if (token && token.length && token !== wordRegexDelimiters) {
            result.push(token.replace(replacePhraseDelimiters, ''));
        }
    }
    return result;
}
1159452
@Override
	public String getText() {
		String text = super.getText();
		FilterTextModel model = getComponentModel();

		if (text != null && model.search != null && model.replace != null) {
			text = text.replaceAll(model.search, model.replace);
		}

		return text;
	}
131801
def input_phrases(phrases, options={})
      strings = phrases.map do |string_key, value|
        if value.is_a? Array
          output = []
          value.each_with_index do |string, index|
            output << {:string_key => string_key.to_s, :string => string, :context => index}
          end
          output
        else
          {:string_key => string_key.to_s, :string => value}
        end
      end
      input_strings(strings.flatten(1), options)
    end
753156
public String wholeText() {
        final StringBuilder accum = StringUtil.borrowBuilder();
        NodeTraversor.traverse(new NodeVisitor() {
            public void head(Node node, int depth) {
                if (node instanceof TextNode) {
                    TextNode textNode = (TextNode) node;
                    accum.append(textNode.getWholeText());
                }
            }

            public void tail(Node node, int depth) {
            }
        }, this);

        return StringUtil.releaseBuilder(accum);
    }
647368
function getSynsetString( input, depth ){
	var current_depth = depth + 1;
	var words;
	if ( isArray(input.words) ) {
		words = input.words.map( function( item ) {
			return item.lemma;
		});
	} else {
		words = new Array( input.lemma );
	}
	var str = "S: (" + input.pos + ") ";
	str += words.join( ", " );
	str += " (" + input.definition + ")";

	if ( input.hypernym ) {
		if ( isArray( input.hypernym ) ){
			input.hypernym.forEach( function( elem ) {
				var times = current_depth * 4;
				var spaces = String( " " ).repeat( times );
				str += "\n" + spaces + getSynsetString( elem, current_depth );
			});
		} else{
			str += "  " + getSynsetString( input.hypernym, current_depth );
		}
	}
	if ( input.hyponym ) {
		if ( isArray(input.hyponym) ) {
			input.hyponym.forEach( function( elem ) {
				var times = current_depth * 4;
				var spaces = String(" ").repeat( times );
				str += "\n" + spaces + getSynsetString( elem, current_depth );
			});
		} else {
			str += "  " + getSynsetString( input.hyponym, current_depth );
		}
	}
	return str;
}
185377
public String contentsAsString()
    {
        if (mResultString == null) {
            // Has array been requested? Can make a shortcut, if so:
            if (mResultArray != null) {
                mResultString = new String(mResultArray);
            } else {
                // Do we use shared array?
                if (mInputStart >= 0) {
                    if (mInputLen < 1) {
                        return (mResultString = "");
                    }
                    mResultString = new String(mInputBuffer, mInputStart, mInputLen);
                } else { // nope... need to copy
                    // But first, let's see if we have just one buffer
                    int segLen = mSegmentSize;
                    int currLen = mCurrentSize;
                    
                    if (segLen == 0) { // yup
                        mResultString = (currLen == 0) ? "" : new String(mCurrentSegment, 0, currLen);
                    } else { // no, need to combine
                        StringBuilder sb = new StringBuilder(segLen + currLen);
                        // First stored segments
                        if (mSegments != null) {
                            for (int i = 0, len = mSegments.size(); i < len; ++i) {
                                char[] curr = mSegments.get(i);
                                sb.append(curr, 0, curr.length);
                            }
                        }
                        // And finally, current segment:
                        sb.append(mCurrentSegment, 0, mCurrentSize);
                        mResultString = sb.toString();
                    }
                }
            }
        }
        return mResultString;
    }
854946
def get_lyrics(artist, song, linesep='\n', timeout=None):
    """"""
    return get_all_lyrics(artist, song, linesep, timeout)[0]
1148692
public List<String> getStrings(String name, String delimiter) {
        String value = getString(name, null);
        if (StringUtils.isNullOrEmpty(value)) {
            return Collections.emptyList();
        }

        value = value.trim();
        // to handles cases where value is specified like [a,b, c]
        if (value.startsWith("[") && value.endsWith("]")) {
            value = value.substring(1, value.length() - 1);
        }
        return StringUtils.getList(value, delimiter);
    }
531710
public String getString() 
    {
        String string = super.getString();
        if ((string != null) && (string.length() > 0))
            string = this.decodeString(string);
        return string;
    }