Changeset 35439
- Timestamp:
- 2021-09-21T11:17:55+12:00 (3 years ago)
- Location:
- main/trunk/model-interfaces-dev/atea/korero-maori-asr/src
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
main/trunk/model-interfaces-dev/atea/korero-maori-asr/src/components/AudioUpload.vue
r35433 r35439 193 193 194 194 try { 195 this.$store.commit(" transcriptionAdd", tvm);195 this.$store.commit("rawTranscriptionAdd", tvm); 196 196 } 197 197 catch (TranscriptionExistsError) { -
main/trunk/model-interfaces-dev/atea/korero-maori-asr/src/components/TranscriptionItem.vue
r35437 r35439 42 42 <hr /> 43 43 44 <TranscriptionItemEditor :transcription="transcription" style="margin-bottom: 1em" />44 <TranscriptionItemEditor ref="editor" :transcription="transcription" style="margin-bottom: 1em" /> 45 45 46 46 <button @click="toggleEditor" type="button" class="btn-primary theme-flat"> … … 94 94 import { mapState } from "vuex"; 95 95 import { saveAs } from "file-saver" 96 import TranscriptionItemEditor , { getWords }from "./TranscriptionItemEditor.vue"96 import TranscriptionItemEditor from "./TranscriptionItemEditor.vue" 97 97 import { TranscriptionViewModel, PlaybackState } from "../main"; 98 98 import Util from "../js/Util" … … 124 124 }, 125 125 remove() { 126 this.$store.commit(" transcriptionRemove", this.transcription.id);126 this.$store.commit("rawTranscriptionRemove", this.transcription.id); 127 127 }, 128 128 downloadAsText() { … … 134 134 downloadAsJson() { 135 135 const fileName = buildDownloadableFileName(this.transcription.fileName, "json"); 136 const toDownload = (({ fileName, transcription, metadata }) => ({ fileName, transcription, metadata }))(this.transcription); 136 const toDownload = (({ fileName, transcription }) => ({ fileName, transcription }))(this.transcription); 137 toDownload.words = this.$refs.editor.words.map(w => (({ word, startTime, endTime }) => ({ word, startTime, endTime }))(w)); 137 138 138 139 const blob = new Blob([ JSON.stringify(toDownload, null, 4) ], { type: "application/json;charset=utf-8" }); … … 141 142 downloadAsWebvtt() { 142 143 const fileName = buildDownloadableFileName(this.transcription.fileName, "vtt"); 143 const toDownload = buildWebvttFileContents(this.transcription );144 const toDownload = buildWebvttFileContents(this.transcription, this.$refs.editor); 144 145 145 146 const blob = new Blob([ toDownload ], { type: "text/vtt;charset=utf-8" }); … … 168 169 * @returns {String} The WebVTT content. 169 170 */ 170 function buildWebvttFileContents(transcription ) {171 function buildWebvttFileContents(transcription, editor) { 171 172 let contents = "WEBVTT Transcription of " + transcription.fileName + "\n\n"; 172 173 173 for (const word of getWords(transcription)) {174 for (const word of editor.words) { 174 175 const startTime = Util.formatSecondsTimeString(word.startTime, true); 175 176 const endTime = Util.formatSecondsTimeString(word.endTime, true); -
main/trunk/model-interfaces-dev/atea/korero-maori-asr/src/components/TranscriptionItemEditor.vue
r35437 r35439 13 13 <li v-for="(word, index) in words" :key="word.id" class="word-container"> 14 14 <input :size="word.word.length <= 1 ? 1 : word.word.length - 1" :ref="word.id" 15 class="editor-word" v-model="word.word" type="text" 15 class="editor-word" v-model="word.word" type="text" onpaste="return false;" 16 16 @input="onEditorInput($event, index)" @focusout="onEditorFocusOut(index)" @keyup="onEditorKeyUp($event, index)" /> 17 17 <span> </span> -
main/trunk/model-interfaces-dev/atea/korero-maori-asr/src/js/TranscribeModule.js
r35389 r35439 12 12 * 13 13 * @param {String} char The character. 14 * @param {Number} confidence The confidence that the character is corre t. Smaller values are more confident.14 * @param {Number} confidence The confidence that the character is correct. Smaller values are more confident. 15 15 * @param {Number} start_time The timestamp in the audio at which this character is spoken. 16 16 */ -
main/trunk/model-interfaces-dev/atea/korero-maori-asr/src/main.js
r35433 r35439 78 78 * @param {TranscriptionViewModel} transcription The transcription's view model object. 79 79 */ 80 transcriptionAdd(state, transcription) {80 rawTranscriptionAdd(state, transcription) { 81 81 if (state.rawTranscriptions.has(transcription.id)) { 82 throw new Error("Transcription already exists");82 throw new TranscriptionExistsError("Cannot add the transcription because it already exists."); 83 83 } 84 84 state.rawTranscriptions.set(transcription.id, transcription); … … 88 88 * Removes a transcription from the store. 89 89 * @param {*} state The state of the store. 90 * @param {String} id The UUID of the transcription.90 * @param {String} id The ID of the transcription. 91 91 */ 92 transcriptionRemove(state, id) {92 rawTranscriptionRemove(state, id) { 93 93 state.rawTranscriptions.delete(id); 94 94 }, -
main/trunk/model-interfaces-dev/atea/korero-maori-asr/src/styles/_material.scss
r35437 r35439 91 91 display: flex; 92 92 align-items: center; 93 text-align: left; 93 94 94 95 background-color: var(--primary-bg-color);
Note:
See TracChangeset
for help on using the changeset viewer.