You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
DocumentSplitter‘s maxOverlapSize parameter sometimes fails .
Look at this method: dev.langchain4j.data.document.splitter.HierarchicalDocumentSplitter#overlapFrom
private String overlapFrom(String segmentText) {
if (maxOverlapSize == 0) {
return "";
}
SegmentBuilder overlapBuilder = new SegmentBuilder(maxOverlapSize, this::sizeOf, joinDelimiter());
String[] sentences = new DocumentBySentenceSplitter(1, 0, null, null).split(segmentText);
for (int i = sentences.length - 1; i >= 0; i--) {
String part = sentences[i];
if (overlapBuilder.hasSpaceFor(part)) {
overlapBuilder.prepend(part);
} else {
return overlapBuilder.build();
}
}
return "";
}```
Should it be returned like this?
```private String overlapFrom(String segmentText) {
if (maxOverlapSize == 0) {
return "";
}
SegmentBuilder overlapBuilder = new SegmentBuilder(maxOverlapSize, this::sizeOf, joinDelimiter());
String[] sentences = new DocumentBySentenceSplitter(1, 0, null, null).split(segmentText);
for (int i = sentences.length - 1; i >= 0; i--) {
String part = sentences[i];
if (overlapBuilder.hasSpaceFor(part)) {
overlapBuilder.prepend(part);
} else {
return overlapBuilder.build();
}
}
**return return overlapBuilder.build();**
}```
- LangChain4j version: e.g. 0.24.0
The text was updated successfully, but these errors were encountered:
DocumentSplitter‘s maxOverlapSize parameter sometimes fails .
Look at this method: dev.langchain4j.data.document.splitter.HierarchicalDocumentSplitter#overlapFrom
The text was updated successfully, but these errors were encountered: