A generic implementation of EmotionML checks, in Java.
As of v1.2.1, release artifacts for this component is available via Maven Central.
Add this to your build.gradle
:
repositories {
mavenCentral()
}
dependencies {
implementation group: 'de.dfki.mary', name: 'emotionml-checker-java', version: '1.2.1'
}
Add this to your pom.xml
:
<dependency>
<groupId>de.dfki.mary</groupId>
<artifactId>emotionml-checker-java</artifactId>
<version>1.2.1</version>
</dependency>
Snapshot releases are hosted via GitHub Packages.
Ensure you have a valid GitHub personal access token with read:packages
scope.
Configure your GitHub username and token as Gradle properties GitHubPackagesUsername
and GitHubPackagesPassword
, respectively.
Then, add this to your build.gradle
:
repositories {
exclusiveContent {
forRepository {
maven {
name 'GitHubPackages'
url 'https://maven.pkg.github.com/marytts/emotionml-checker-java'
credentials PasswordCredentials
}
}
filter {
includeModule 'de.dfki.mary', 'emotionml-checker-java'
}
}
}
dependencies {
implementation group: 'de.dfki.mary', name: 'emotionml-checker-java', version: '1.3-SNAPSHOT'
}
Configure your Maven settings.xml
to authenticate to GitHub Packages.
Then, add this to your pom.xml
:
<dependency>
<groupId>de.dfki.mary</groupId>
<artifactId>emotionml-checker-java</artifactId>
<version>1.3-SNAPSHOT</version>
</dependency>
Run
./gradlew build
The EmotionML checker can be used to verify the validity of a set of EmotionML files as follows:
java -jar emotionml-checker-java.jar file.emotionml [more emotionml files]
where file.emotionml
is an XML file containing the EmotionML document to be validated.
The tool will print for each file either an "ok" or a validation error message.
Key APIs to use from Java code are the following.
To verify that a given XML document is valid EmotionML:
new Checker().parse(InputStream);
new Checker().validate(Document);
new Checker().validateFragment(DocumentFragment);
To obtain a certain Emotion Vocabulary:
EmotionVocabulary.get(String vocabularyUriWithId);
To inquire about properties of an Emotion Vocabulary:
vocabulary.getType()
vocabulary.getItems()