@Test void keySpaceValue() throws Exception { Document doc = parse("hello world"); Sentence sentence = doc.getLastSection().getParagraph(0).getSentence(0); assertEquals("world", sentence.getContent()); }
@Override public Document parse(InputStream inputStream, Optional<String> fileName, SentenceExtractor sentenceExtractor, RedPenTokenizer tokenizer) throws RedPenException { Document.DocumentBuilder builder = Document.builder(tokenizer); fileName.ifPresent(builder::setFileName); try (PreprocessingReader reader = createReader(inputStream)) { String line; AtomicInteger lineNum = new AtomicInteger(0); while ((line = reader.readLine()) != null) { lineNum.incrementAndGet(); int keyStart = skipWhitespace(line, 0); if (keyStart == line.length()) continue; int valueStart = valueOffset(line, keyStart); addSentences(builder, sentenceExtractor, section(line, lineNum, valueStart, reader)); } builder.setPreprocessorRules(reader.getPreprocessorRules()); } catch (IOException e) { throw new RedPenException(e); } return builder.build(); }
PropertiesParser extends BaseDocumentParser { @Override public Document parse(InputStream inputStream, Optional<String> fileName, SentenceExtractor sentenceExtractor, RedPenTokenizer tokenizer) throws RedPenException { Document.DocumentBuilder builder = Document.builder(tokenizer); fileName.ifPresent(builder::setFileName); try (PreprocessingReader reader = createReader(inputStream)) { String line; AtomicInteger lineNum = new AtomicInteger(0); while ((line = reader.readLine()) != null) { lineNum.incrementAndGet(); int keyStart = skipWhitespace(line, 0); if (keyStart == line.length()) continue; int valueStart = valueOffset(line, keyStart); addSentences(builder, sentenceExtractor, section(line, lineNum, valueStart, reader)); } builder.setPreprocessorRules(reader.getPreprocessorRules()); } catch (IOException e) { throw new RedPenException(e); } return builder.build(); } }
PropertiesParser extends BaseDocumentParser { @Override public Document parse(InputStream inputStream, Optional<String> fileName, SentenceExtractor sentenceExtractor, RedPenTokenizer tokenizer) throws RedPenException { Document.DocumentBuilder builder = Document.builder(tokenizer); fileName.ifPresent(builder::setFileName); try (PreprocessingReader reader = createReader(inputStream)) { String line; AtomicInteger lineNum = new AtomicInteger(0); while ((line = reader.readLine()) != null) { lineNum.incrementAndGet(); int keyStart = skipWhitespace(line, 0); if (keyStart == line.length()) continue; int valueStart = valueOffset(line, keyStart); addSentences(builder, sentenceExtractor, section(line, lineNum, valueStart, reader)); } builder.setPreprocessorRules(reader.getPreprocessorRules()); } catch (IOException e) { throw new RedPenException(e); } return builder.build(); }  }
PropertiesParser extends BaseDocumentParser { @Override public Document parse(InputStream inputStream, Optional<String> fileName, SentenceExtractor sentenceExtractor, RedPenTokenizer tokenizer) throws RedPenException { Document.DocumentBuilder builder = Document.builder(tokenizer); fileName.ifPresent(builder::setFileName); try (PreprocessingReader reader = createReader(inputStream)) { String line; AtomicInteger lineNum = new AtomicInteger(0); while ((line = reader.readLine()) != null) { lineNum.incrementAndGet(); int keyStart = skipWhitespace(line, 0); if (keyStart == line.length()) continue; int valueStart = valueOffset(line, keyStart); addSentences(builder, sentenceExtractor, section(line, lineNum, valueStart, reader)); } builder.setPreprocessorRules(reader.getPreprocessorRules()); } catch (IOException e) { throw new RedPenException(e); } return builder.build(); }  @Override Document parse(InputStream inputStream, Optional<String> fileName, SentenceExtractor sentenceExtractor, RedPenTokenizer tokenizer); }
PropertiesParser extends BaseDocumentParser { @Override public Document parse(InputStream inputStream, Optional<String> fileName, SentenceExtractor sentenceExtractor, RedPenTokenizer tokenizer) throws RedPenException { Document.DocumentBuilder builder = Document.builder(tokenizer); fileName.ifPresent(builder::setFileName); try (PreprocessingReader reader = createReader(inputStream)) { String line; AtomicInteger lineNum = new AtomicInteger(0); while ((line = reader.readLine()) != null) { lineNum.incrementAndGet(); int keyStart = skipWhitespace(line, 0); if (keyStart == line.length()) continue; int valueStart = valueOffset(line, keyStart); addSentences(builder, sentenceExtractor, section(line, lineNum, valueStart, reader)); } builder.setPreprocessorRules(reader.getPreprocessorRules()); } catch (IOException e) { throw new RedPenException(e); } return builder.build(); }  @Override Document parse(InputStream inputStream, Optional<String> fileName, SentenceExtractor sentenceExtractor, RedPenTokenizer tokenizer);  }