Verified Owner
Top Fields Constructors Methods
org.jabref.logic.relatedwork

public Class RelatedWorkTextParser

extends Object
Class Inheritance
Annotations
@NullMarked
Imports
java.util.ArrayList, .List, java.util.regex.MatchResult, .Pattern, org.jspecify.annotations.NullMarked

Field Summary

Modifier and TypeField and Description
private static final Pattern
CITE_PATTERN

Support [1] / [1-3] / [1, 2, 3] / [1-3, 7, 9]

private static final Pattern
private static final Pattern
private static final Pattern
private static final Pattern
private static final Pattern
private static final Pattern
private static final Pattern

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
private String
extractContextText(String text)

Remove citationKeys

public String
getNormalText(String text)

Some long words may contain a hyphen and a newline symbol.

public List<RelatedWorkSnippet>
parseRelatedWork(String text)

This method first cuts long texts into separate sentence segments, and then parse these sentences.

public List<RelatedWorkSnippet>
parseTextSegment(String text)

Parse a sentence into citationKeys and text.

private List<String>
splitCitation(String citation)

Split citations groups by comma, and then split into single citation by connector (if contains)

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

CITE_PATTERNback to summary
private static final Pattern CITE_PATTERN

Support [1] / [1-3] / [1, 2, 3] / [1-3, 7, 9]

HYPHENATED_LINE_BREAK_PATTERNback to summary
private static final Pattern HYPHENATED_LINE_BREAK_PATTERN
NEWLINE_WITHOUT_SENTENCE_END_PATTERNback to summary
private static final Pattern NEWLINE_WITHOUT_SENTENCE_END_PATTERN
SEGMENT_SPLIT_PATTERNback to summary
private static final Pattern SEGMENT_SPLIT_PATTERN
SPACE_BEFORE_PUNCTUATION_PATTERNback to summary
private static final Pattern SPACE_BEFORE_PUNCTUATION_PATTERN
TRAILING_CONJUNCTION_PATTERNback to summary
private static final Pattern TRAILING_CONJUNCTION_PATTERN
TRAILING_CONJUNCTION_WITH_PUNCTUATION_PATTERNback to summary
private static final Pattern TRAILING_CONJUNCTION_WITH_PUNCTUATION_PATTERN
WHITESPACE_PATTERNback to summary
private static final Pattern WHITESPACE_PATTERN

Constructor Detail

RelatedWorkTextParserback to summary
public RelatedWorkTextParser()

Method Detail

extractContextTextback to summary
private String extractContextText(String text)

Remove citationKeys

getNormalTextback to summary
public String getNormalText(String text)

Some long words may contain a hyphen and a newline symbol. This method transforms these words into normal ones.

parseRelatedWorkback to summary
public List<RelatedWorkSnippet> parseRelatedWork(String text)

This method first cuts long texts into separate sentence segments, and then parse these sentences.

parseTextSegmentback to summary
public List<RelatedWorkSnippet> parseTextSegment(String text)

Parse a sentence into citationKeys and text.

splitCitationback to summary
private List<String> splitCitation(String citation)

Split citations groups by comma, and then split into single citation by connector (if contains)