nzilbb.labbcat module for communicating with LaBB-CAT web application servers.
What is LaBB-CAT?
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.
What is this library?
The library copies from nzilbb.ag.IGraphStoreQuery and related Java interfaces, for standardized API calls.
nzilbb.labbcat is available as an npm package here.
nzilbb.labbcat.js can also be used as a browser-importable script.
This API is has the following object model:
- LabbcatView
- implements read-only functions for a LaBB-CAT graph
store, corresponding to
view
permissions in LaBB-CAT. - LabbcatEdit
- inherits all LabbcatView functions, and also
implements some graph store editing functions, corresponding to
edit
permissions in LaBB-CAT. - LabbcatAdmin
- inherits all LabbcatEdit functions, and also
implements some administration functions, corresponding to
admin
permissions in LaBB-CAT.
- Copyright:
- 2016-2020 New Zealand Institute of Language, Brain and Behaviour, University of Canterbury This file is part of LaBB-CAT. LaBB-CAT is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. LaBB-CAT is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with LaBB-CAT; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- License:
- magnet:?xt=urn:btih:1f739d935676111cfff4b4693e3816e664797050&dn=gpl-3.0.txt GPL v3.0
- Source:
Example
const corpus = new labbcat.LabbcatView("https://sometld.com", "your username", "your password");
// optionally, we can set the language that messages are returned in
labbcat.language = "es";
// get the first participant in the corpus
corpus.getParticipantIds((ids, errors, messages)=>{
const participantId = ids[0];
// all their instances of "the" followed by a word starting with a vowel
const pattern = [
{"orthography" : "i"},
{"phonemes" : "[cCEFHiIPqQuUV0123456789~#\\$@].*"}];
// start searching
corpus.search(pattern, [ participantId ], false, (response, errors, messages)=>{
const taskId = response.threadId
// wait for the search to finish
corpus.waitForTask(taskId, 30, (task, errors, messages)=>{
// get the matches
corpus.getMatches(taskId, (result, errors, messages)=>{
const matches = result.matches;
console.log("There were " + matches.length + " matches for " + participantId);
// get TextGrids of the utterances
corpus.getFragments(
matches, [ "orthography", "phonemes" ], "text/praat-textgrid",
(textgrids, errors, messages)=>{
for (let textgrid of textgrids) {
console.log(textgrid);
}
// get the utterance recordings
corpus.getSoundFragments(matches, (wavs, errors, messages)=>{
for (let wav of wavs) {
console.log(wav);
}
});
});
});
});
});
});