Client library for communicating with LaBB-CAT servers using Java.
LaBB-CAT is a web-based linguistic annotation store that stores audio or video recordings, text transcripts, and other annotations.
Annotations of various types can be automatically generated or manually added.
LaBB-CAT servers are usually password-protected linguistic corpora, and can be accessed manually via a web browser, or programmatically using a client library like this one.
Detailed documentation is available at https://nzilbb.github.io/labbcat-java/
mvn package
- builds target/nzilbb.labbcat-n.n.n.jarmvn test
- runs unit tests, which requires a running LaBB-CAT server to work; you must set the URL/credentials in the unit test files in nzilbb/labbcat/test/mvn site
- produces JavaDoc API documentation.
The following example shows how to:
- get some basic corpus structure information,
- upload a transcript,
- wait for annotation layer generation to finish,
- extract the newly-generated annotations, and
- search for instances of the word "and".
// create LaBB-CAT client
LabbcatView labbcat = new LabbcatView("https://labbcat.canterbury.ac.nz", "demo", "demo");
// get a corpus ID
String[] corpora = labbcat.getCorpusIds();
String corpus = ids[0];
// get a transcript type
Layer typeLayer = labbcat.getLayer("transcript_type");
String transcriptType = typeLayer.getValidLabels().keySet().iterator().next();
// upload a transcript
File transcript = new File("/some/transcript.txt");
String taskId = labbcat.newTranscript(transcript, null, null, transcriptType, corpus, "test");
// wait until all automatic annotations have been generated
TaskStatus layerGenerationTask = labbcat.waitForTask(taskId, 30);
// get all the POS annotations
Annotation[] pos = labbcat.getAnnotations(transcript.getName(), "pos");
// search for tokens of "and"
Matches[] matches = labbcat.getMatches(
labbcat.search(
new PatternBuilder().addMatchLayer("orthography", "and").build(),
participantIds, null, true, false, null), 1);
- The JDK for at least Java 8
sudo apt install default-jdk
- Maven
sudo apt install maven
mvn package
mvn test
mvn site
OSSRH is the central Maven repository where nzilbb.ag modules are deployed (published).
There are two type of deployment:
- snapshot: a transient deployment that can be updated during development/testing
- release: an official published version that cannot be changed once it's deployed
A snapshot deployment is done when the module version (version
tag in pom.xml) ends with
-SNAPSHOT
. Otherwise, any deployment is a release.
To perform a snapshot deployment:
- Ensure the
version
in pom.xml is suffixed with-SNAPSHOT
- Execute the command:
mvn clean deploy
To perform a release deployment:
- Ensure the
version
in pom.xml isn't suffixed with-SNAPSHOT
e.g. use something like the following command from within the ag directory:mvn versions:set -DnewVersion=1.1.0
- Execute the command:
mvn clean deploy -P release
- Happy with everything? Complete the release with:
Otherwise:
mvn nexus-staging:release -P release
...and start again.mvn nexus-staging:drop -P release
- Regenerate the citation file:
mvn cff:create
- Commit/push all changes and create a release in GitHub