Skip to content

Commit

Permalink
OPENNLP-421 - Remove StringListWrapper
Browse files Browse the repository at this point in the history
  • Loading branch information
rzo1 committed Dec 19, 2023
1 parent 0642483 commit 767a209
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -334,6 +334,13 @@ public Class<?> getArtifactSerializerClass() {
return DictionarySerializer.class;
}

/**
* @return {@code true}, if this {@link Dictionary} is case-sensitive.
*/
public boolean isCaseSensitive() {
return isCaseSensitive;
}

private StringList applyCaseSensitivity(StringList list) {
if (isCaseSensitive) {
return list.toCaseSensitive();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public class DictionaryNameFinder implements TokenNameFinder {
* @param type the name type used for the produced spans. Must not be {@code null}.
*/
public DictionaryNameFinder(Dictionary dictionary, String type) {
mDictionary = Objects.requireNonNull(dictionary, "dictionary must not be null");
this.mDictionary = Objects.requireNonNull(dictionary, "dictionary must not be null");
this.type = Objects.requireNonNull(type, "type must not be null");
}

Expand Down Expand Up @@ -76,7 +76,7 @@ public Span[] find(String[] textTokenized) {
System.arraycopy(textTokenized, offsetFrom, tokensSearching, 0,
lengthSearching);

StringList entryForSearch = new StringList(tokensSearching);
StringList entryForSearch = new StringList(mDictionary.isCaseSensitive(), tokensSearching);

if (mDictionary.contains(entryForSearch)) {
nameFound = new Span(offsetFrom, offsetTo + 1, type);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ public boolean equals(Object obj) {
}

/**
* @return A human-readable representation of this {@link Span}.
* @return A human-readable representation of this {@link StringList}.
*/
@Override
public String toString() {
Expand All @@ -202,7 +202,7 @@ public String toString() {
}

/**
* @return {@code true}, if {@code equals(...)} honors cases.
* @return {@code true}, if this {@link StringList} is case-sensitive.
*/
public boolean isCaseSensitive() {
return caseSensitive;
Expand Down

0 comments on commit 767a209

Please sign in to comment.