java - How to extract each sentence from a text file using stanford-parser? -


i need extract each sentence given text file , store sentence in string. using lexparser-gui of stanford-parser, tool highlights each sentence of given file. there way, can use stanford-parser.jar sentence extraction in java program? if yes, please give sample demo on how it.

thanks, sambhav

if want extract sentences text file, there's no need use parser. can take regular sentence splitter, so:

    properties props = new properties();      props.setproperty("annotators","tokenize, ssplit");      stanfordcorenlp pipeline = new stanfordcorenlp(props);     annotation annotation = new annotation("this sentence one. sentence two.");     pipeline.annotate(annotation);     list<coremap> sentences = annotation.get(coreannotations.sentencesannotation.class);     (coremap sentence : sentences) {         system.out.println(sentence);     } 

Comments

Popular posts from this blog

java - Spring Data JPA: Why findOne(id) executing delete query internally? -

python - Mongodb How to add addtional information when aggregating? -

java - Incorrect order of records in M-M relationship in hibernate -