Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Minor changes #2

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions src/main/java/eus/ixa/ixa/pipe/ml/utils/IOUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ public final class IOUtils {
public static final int BUFFER_SIZE = 65536;
public static final String SPACE_DELIMITER = " ";
public static final String TAB_DELIMITER = "\t";
private static final String DEFAULT_RESOURCES_PATH = "src/main/resources";

/**
* Private constructor. This class should only be used statically.
Expand All @@ -77,7 +78,7 @@ private IOUtils() {
* the dictionary path
* @return the dictionary path without punctuation
*/
public static final String normalizeLexiconName(String resource) {
public static String normalizeLexiconName(String resource) {
resource = resource.replaceAll("\\p{P}", "");
return resource;
}
Expand All @@ -91,7 +92,7 @@ public static final String normalizeLexiconName(String resource) {
* the name of the resource (absolute path with no starting /)
* @return the inputstream of the dictionary
*/
public static final InputStream getDictionaryResource(final String resource) {
public static InputStream getDictionaryResource(final String resource) {

InputStream dictInputStream;
final Path resourcePath = Paths.get(resource);
Expand All @@ -117,7 +118,7 @@ public static final InputStream getDictionaryResource(final String resource) {
private static InputStream getStreamFromClassPath(
final String normalizedPath) {
InputStream dictInputStream = null;
final String[] dictPaths = normalizedPath.split("src/main/resources");
final String[] dictPaths = normalizedPath.split(DEFAULT_RESOURCES_PATH);
if (dictPaths.length == 2) {
dictInputStream = IOUtils.class.getClassLoader()
.getResourceAsStream(dictPaths[1]);
Expand Down
8 changes: 4 additions & 4 deletions src/main/java/eus/ixa/ixa/pipe/ml/utils/Span.java
Original file line number Diff line number Diff line change
Expand Up @@ -455,8 +455,8 @@ public static String[] getTypesFromSpans(final Span[] spans,
* @param postList
* the list of spans to do the post-processing
*/
public static final void postProcessDuplicatedSpans(final List<Span> preList,
final Span[] postList) {
public static void postProcessDuplicatedSpans(final List<Span> preList,
final Span[] postList) {
final List<Span> duplicatedSpans = new ArrayList<Span>();
for (final Span span1 : preList) {
for (final Span span2 : postList) {
Expand All @@ -479,8 +479,8 @@ public static final void postProcessDuplicatedSpans(final List<Span> preList,
* @param neSpans
* the spans to be added to allSpans
*/
public static final void concatenateSpans(final List<Span> allSpans,
final Span[] neSpans) {
public static void concatenateSpans(final List<Span> allSpans,
final Span[] neSpans) {
for (final Span span : neSpans) {
allSpans.add(span);
}
Expand Down
6 changes: 1 addition & 5 deletions src/main/java/eus/ixa/ixa/pipe/ml/utils/StringUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public final class StringUtils {
/**
* Pattern to remove double bars from disjunct regex.
*/
public static Pattern doubleBar = Pattern.compile("\\|\\|");
public static final Pattern doubleBar = Pattern.compile("\\|\\|");

/**
* Private constructor.
Expand Down Expand Up @@ -67,7 +67,6 @@ public static List<Integer> exactTokenFinderIgnoreCase(final String pattern,
for (j = 0; j <= sentenceLength - patternLength; ++j) {
for (i = 0; i < patternLength
&& patternTokens[i].equalsIgnoreCase(tokens[i + j]); ++i) {
;
}
if (i >= patternLength) {
neTokens.add(j);
Expand Down Expand Up @@ -97,7 +96,6 @@ public static List<Integer> exactTokenFinder(final String pattern,
for (j = 0; j <= sentenceLength - patternLength; ++j) {
for (i = 0; i < patternLength
&& patternTokens[i].equals(tokens[i + j]); ++i) {
;
}
if (i >= patternLength) {
neTokens.add(j);
Expand Down Expand Up @@ -130,7 +128,6 @@ public static List<Integer> exactStringFinder(final String pattern,
for (j = 0; j <= sentenceLength - patternLength; ++j) {
for (i = 0; i < patternLength
&& patternArray[i] == sentenceArray[i + j]; ++i) {
;
}
if (i >= patternLength) {
neChars.add(j);
Expand Down Expand Up @@ -326,7 +323,6 @@ public static void computeShortestEditScript(final String wordForm,
if (lemmaLength > 0 && distance[wordFormLength][lemmaLength
- 1] == distance[wordFormLength][lemmaLength]) {
lemmaLength--;
continue;
}
}
}
Expand Down