@SuppressWarnings("SimplifiableIfStatement") @Override public boolean equals(Object o) { if (this == o) return true; if (!(o instanceof Document)) return false; Document document = (Document) o; if (impl.hasText() && !impl.getText().equals(document.impl.getText())) { return false; } return impl.build().equals(document.impl.build()) && sentences.equals(document.sentences); }
@Override public int hashCode() { if (impl.hasText()) { return impl.getText().hashCode(); } else { return impl.build().hashCode(); } }
Annotator ssplit = props == EMPTY_PROPS ? defaultSSplit : getOrCreate(STANFORD_SSPLIT, props, () -> backend.wordToSentences(props)).get(); Annotation ann = new Annotation(this.impl.getText()); tokenizer.annotate(ann); ssplit.annotate(ann);
Annotator ssplit = props == EMPTY_PROPS ? defaultSSplit : getOrCreate(STANFORD_SSPLIT, props, () -> backend.wordToSentences(props)).get(); Annotation ann = new Annotation(this.impl.getText()); tokenizer.annotate(ann); ssplit.annotate(ann);
@Override public String toString() { return impl.getText(); }
@SuppressWarnings("SimplifiableIfStatement") @Override public boolean equals(Object o) { if (this == o) return true; if (!(o instanceof Document)) return false; Document document = (Document) o; if (impl.hasText() && !impl.getText().equals(document.impl.getText())) { return false; } return impl.build().equals(document.impl.build()) && sentences.equals(document.sentences); }
@Override public int hashCode() { if (impl.hasText()) { return impl.getText().hashCode(); } else { return impl.build().hashCode(); } }
/** Get the raw text of the document, as input by, e.g., {@link Document#Document(String)}. */ public String text() { synchronized (impl) { return impl.getText(); } }
@Override public String toString() { return impl.getText(); }
/** Get the raw text of the document, as input by, e.g., {@link Document#Document(String)}. */ public String text() { synchronized (impl) { return impl.getText(); } }