class SentenceWriter extends Processor {

	protected void writeSentences(CrawlURI curi, String cleaned_plaintext) {
		String perplexity_value_as_string = "null";
		if(curi != null && curi.getData() != null){
			Object obj = curi.getData().get(SharedConstants.EXTRA_INFO_PERPLEXITY);
			if(obj != null)
				perplexity_value_as_string = (String)obj;
		}
		String time = TimeUtils.get_ISO_8601_UTC();
		int c = 0;
		synchronized (_lck) {
			for(String sentence :  _sentence_maker.getSentences(cleaned_plaintext, _languagecode)){
				String s = String.format("%s\t%s\t%s\t%d\t%s%n", time, sentence, curi, ++c, perplexity_value_as_string);
				_current_stream.print(s);
				_num_bytes_written.getAndAdd(s.getBytes().length);
				_num_bytes_sentences_written.getAndAdd(sentence.getBytes().length);
			}
			_current_stream.flush();
		}
		_num_sentences.getAndAdd(c);
		_num_uris_written.getAndIncrement();
	}

}

class SentenceWriterTest {

	@Test
	public void test() {

		SentenceWriter w = new SentenceWriter(){{_sentence_maker = new SentenceMaker();}};
		w._current_stream = System.out;
		w.writeSentences(null, "This is a test. This is also a test.");
	}

}