Skip to content
Merged
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
66 changes: 45 additions & 21 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -13,23 +13,23 @@ buildscript {
}
dependencies {
classpath 'gradle.plugin.org.kt3k.gradle.plugin:coveralls-gradle-plugin:2.12.0'
classpath "gradle.plugin.com.github.jengelman.gradle.plugins:shadow:7.0.0"
classpath 'com.adarshr:gradle-test-logger-plugin:2.0.0'
classpath group: 'org.yaml', name: 'snakeyaml', version: '1.19'
}
}

plugins {
id 'com.github.johnrengelman.shadow' version '7.1.0'
id 'com.github.johnrengelman.shadow' version '8.1.1'
id 'org.ajoberstar.grgit' version '5.3.0' apply false
id 'distribution'
id 'application'
id "org.jetbrains.kotlin.jvm" version "1.8.21"
}

apply plugin: 'jacoco'

jacoco {
toolVersion = '0.8.8'
toolVersion = '0.8.11'
}

apply plugin: 'java-library'
Expand Down Expand Up @@ -89,29 +89,31 @@ dependencies {

//Apache commons
implementation group: 'commons-pool', name: 'commons-pool', version: '1.6'
implementation group: 'commons-io', name: 'commons-io', version: '2.9.0'
implementation group: 'commons-io', name: 'commons-io', version: '2.14.0'
implementation group: 'org.apache.httpcomponents', name: 'httpclient', version: '4.5.14'
implementation group: 'org.apache.httpcomponents', name: 'httpmime', version: '4.5.3'
implementation group: 'org.apache.commons', name: 'commons-lang3', version: '3.6'
implementation group: 'org.apache.commons', name: 'commons-collections4', version: '4.4'
implementation group: 'org.apache.commons', name: 'commons-csv', version: '1.5'

//Dropwizard
implementation "io.dropwizard:dropwizard-core:1.3.23"
implementation "io.dropwizard:dropwizard-assets:1.3.23"
implementation "com.hubspot.dropwizard:dropwizard-guicier:1.3.5.0"
implementation "io.dropwizard:dropwizard-testing:1.3.23"
implementation "io.dropwizard:dropwizard-forms:1.3.23"
implementation "io.dropwizard:dropwizard-client:1.3.23"
implementation "io.dropwizard:dropwizard-auth:1.3.23"
implementation "io.dropwizard.metrics:metrics-core:4.0.0"
implementation "io.dropwizard.metrics:metrics-servlets:4.0.0"

implementation group: 'com.google.guava', name: 'guava', version: '28.2-jre'
implementation 'ru.vyarus:dropwizard-guicey:7.0.0'

implementation 'io.dropwizard:dropwizard-bom:4.0.2'
implementation 'io.dropwizard:dropwizard-core:4.0.2'
implementation 'io.dropwizard:dropwizard-assets:4.0.2'
implementation 'io.dropwizard:dropwizard-testing:4.0.2'
implementation 'io.dropwizard:dropwizard-forms:4.0.2'
implementation 'io.dropwizard:dropwizard-client:4.0.2'
implementation 'io.dropwizard:dropwizard-auth:4.0.2'
implementation 'io.dropwizard.metrics:metrics-core:4.2.22'
implementation 'io.dropwizard.metrics:metrics-servlets:4.2.22'

implementation group: 'com.google.guava', name: 'guava', version: '32.0.1-jre'

//Parsing xml/json
implementation group: 'com.fasterxml.jackson.core', name: 'jackson-core', version: '2.10.1'
implementation group: 'com.fasterxml.jackson.core', name: 'jackson-databind', version: '2.10.1'
implementation group: 'com.fasterxml.jackson.core', name: 'jackson-core', version: '2.13.1'
implementation group: 'com.fasterxml.jackson.core', name: 'jackson-databind', version: '2.13.4.2'
implementation group: 'com.fasterxml.jackson.core', name: 'jackson-annotations', version: '2.10.1'
implementation group: 'xom', name: 'xom', version: '1.3.2'
implementation group: 'javax.xml.bind', name: 'jaxb-api', version: '2.3.0'
Expand Down Expand Up @@ -141,10 +143,27 @@ dependencies {
}

//Tests
testImplementation group: 'junit', name: 'junit', version: '4.12'
testImplementation group: 'org.hamcrest', name: 'hamcrest-all', version: '1.3'
testImplementation(platform('org.junit:junit-bom:5.10.2'))
testRuntimeOnly("org.junit.platform:junit-platform-launcher") {
because("Only needed to run tests in a version of IntelliJ IDEA that bundles older versions")
}
testRuntimeOnly("org.junit.jupiter:junit-jupiter-engine")
testImplementation('org.junit.jupiter:junit-jupiter')
testRuntimeOnly("org.junit.vintage:junit-vintage-engine") {
because 'allows JUnit 3 and JUnit 4 tests to run'
}

testRuntimeOnly("org.junit.platform:junit-platform-launcher") {
because 'allows tests to run from IDEs that bundle older version of launcher'
}
testImplementation 'org.easymock:easymock:5.2.0'
testImplementation 'org.hamcrest:hamcrest-all:1.3'
testImplementation 'org.hamcrest:hamcrest-library:2.2'
testImplementation 'org.powermock:powermock-module-junit4:2.0.9'
testImplementation 'org.powermock:powermock-api-easymock:2.0.9'
testImplementation 'org.jetbrains.kotlin:kotlin-test'
testImplementation "io.mockk:mockk:1.13.9"

}

configurations.all {
Expand All @@ -155,6 +174,7 @@ configurations.all {
exclude group: 'org.slf4j', module: "slf4j-log4j12"
}


def getJavaLibraryPath = {
def jepLocalLibraries = ""
if (Os.isFamily(Os.FAMILY_MAC)) {
Expand Down Expand Up @@ -275,6 +295,10 @@ jar {
enabled true
}

artifacts {
archives shadowJar
}

distZip.enabled = true
distTar.enabled = false
shadowDistZip.enabled = false
Expand Down Expand Up @@ -437,8 +461,8 @@ application {

jacocoTestReport {
reports {
xml.enabled = true // coveralls plugin depends on xml format report
html.enabled = true
xml.required = true // coveralls plugin depends on xml format report
html.required = true
}
dependsOn test // tests are required to run before generating the report
}
Expand Down
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.2-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-bin.zip
10 changes: 5 additions & 5 deletions resources/config/config-docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ entityFishingPort: 443
#entityFishingPort: 8090

# if true we use binary classifiers for the contexts, otherwise use a single multi-label classifier
# binary classifiers perform better, but havier to use
# binary classifiers perform better, but heavier to use
useBinaryContextClassifiers: false

# sequence labeling model (identify data-related sections)
Expand All @@ -35,7 +35,7 @@ models:
window: 20
nbMaxIterations: 2000

# classifier model, dataset binary (datset or not dataset in the current sentence)
# classifier model, dataset binary (dataset or not dataset in the current sentence)
- name: "dataseer-binary"
engine: "delft"
delft:
Expand Down Expand Up @@ -120,7 +120,6 @@ models:
architecture: "bert"
transformer: "michiyasunaga/LinkBERT-basecased"


# Limit the maximum number of requests (0, no limit)
maxParallelRequests: 0

Expand All @@ -131,17 +130,18 @@ corsAllowedHeaders: "X-Requested-With,Content-Type,Accept,Origin"

server:
type: custom
idleTimeout: 120 seconds
applicationConnectors:
- type: http
port: 8060
idleTimeout: 120 seconds
acceptQueueSize: 2048
adminConnectors:
- type: http
port: 8061
registerDefaultExceptionMappers: false
maxThreads: 2048
maxQueuedRequests: 2048
acceptQueueSize: 2048

requestLog:
appenders: []

Expand Down
5 changes: 3 additions & 2 deletions resources/config/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -131,17 +131,18 @@ corsAllowedHeaders: "X-Requested-With,Content-Type,Accept,Origin"

server:
type: custom
idleTimeout: 120 seconds
applicationConnectors:
- type: http
port: 8060
idleTimeout: 120 seconds
acceptQueueSize: 2048
adminConnectors:
- type: http
port: 8061
registerDefaultExceptionMappers: false
maxThreads: 2048
maxQueuedRequests: 2048
acceptQueueSize: 2048

requestLog:
appenders: []

Expand Down
36 changes: 14 additions & 22 deletions src/main/java/org/grobid/core/data/BiblioComponent.java
Original file line number Diff line number Diff line change
@@ -1,27 +1,19 @@
package org.grobid.core.data;

import org.grobid.core.engines.label.TaggingLabel;
import org.grobid.core.utilities.TextUtilities;
import org.grobid.core.utilities.OffsetPosition;
import org.grobid.core.lexicon.DatastetLexicon;
import org.grobid.core.layout.BoundingBox;
import org.grobid.core.layout.LayoutToken;

import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;

import java.util.List;

import org.grobid.core.layout.BoundingBox;
import org.grobid.core.utilities.TextUtilities;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
* Representation of the bibliographical reference element for a software mention.
* The component represent the reference callout (position) and its matched full
* bibliographical reference.
*
* The bibliographical reference can also be disambiguated against wikidata via
* its (inherited) KnowledgeEntity object attributes.
* Representation of the bibliographical reference element for a software mention.
* The component represent the reference callout (position) and its matched full
* bibliographical reference.
* <p>
* The bibliographical reference can also be disambiguated against wikidata via
* its (inherited) KnowledgeEntity object attributes.
*/
public class BiblioComponent extends DatasetComponent {
private static final Logger logger = LoggerFactory.getLogger(BiblioComponent.class);
Expand Down Expand Up @@ -62,10 +54,10 @@ public int getRefKey() {

public String toJson() {
ObjectMapper mapper = new ObjectMapper();

StringBuffer buffer = new StringBuffer();
buffer.append("{ ");

try {
buffer.append("\"label\" : " + mapper.writeValueAsString(rawForm));
} catch (JsonProcessingException e) {
Expand All @@ -82,7 +74,7 @@ public String toJson() {
}
}*/
buffer.append(", \"refKey\": " + refKey);

// knowledge information
if (wikidataId != null) {
buffer.append(", \"wikidataId\": \"" + wikidataId + "\"");
Expand All @@ -99,10 +91,10 @@ public String toJson() {

if (offsets != null) {
buffer.append(", \"offsetStart\" : " + offsets.start);
buffer.append(", \"offsetEnd\" : " + offsets.end);
buffer.append(", \"offsetEnd\" : " + offsets.end);
}

if ( (boundingBoxes != null) && (boundingBoxes.size() > 0) ) {
if ((boundingBoxes != null) && (boundingBoxes.size() > 0)) {
buffer.append(", \"boundingBoxes\" : [");
boolean first = true;
for (BoundingBox box : boundingBoxes) {
Expand All @@ -114,7 +106,7 @@ public String toJson() {
}
buffer.append("] ");
}

buffer.append(" }");
return buffer.toString();
}
Expand Down
Loading
Loading