Skip to content

Commit

Permalink
gs_index: metadata
Browse files Browse the repository at this point in the history
  • Loading branch information
parkchamchi committed Oct 31, 2024
1 parent f929e9f commit 6176bf0
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 12 deletions.
45 changes: 35 additions & 10 deletions src/backend/gs_index/src/components/Corpus.vue
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
corpus: null,
cursor: null,
showPre: false,
showMetadata: false,
}
},
computed: {
Expand Down Expand Up @@ -166,6 +166,10 @@
});
},
toggleShowMetadata() {
this.showMetadata =!this.showMetadata;
},
onAnnotateP(p_index) {
this.annotate([p_index]);
},
Expand Down Expand Up @@ -200,12 +204,17 @@
<input v-model.number="cursor" type="number" class="form-control w-auto d-inline" :min="0" :max="corpus.paragraphs.length-1" />
<span>/{{ this.corpus.paragraphs.length - 1 }}</span>
<button class="btn" @click="psNext"> >> </button>

<button class="btn"
@click="toggleShowMetadata"
style="margin-left: auto; margin-right: 0;">[i]</button>
</div>
<div class="corpus" ref="corpus">
<span class="corpus_buttons_span">
<button class="corpus_button btn btn-light" @click="download()">Download</button>

<span>
<div v-if="showMetadata">
<hr>
<div class="corpus_buttons_span" >
<button class="corpus_button btn btn-light" @click="download()">Download</button>

<button :class="['corpus_button', 'btn', divideButtonClass]" @click="divide()">Divide</button>
<button :class="['corpus_button', 'btn', divideButtonClass]" @click="divide('\\n\\n')">Divide (for poems)</button>

Expand All @@ -216,12 +225,17 @@
<button :class="['corpus_button', 'btn', annotateButtonClass]" @click="annotate(null)">
Annotate (Reset)
</button>
</span>
</span>
<br>
</div>

<ul>
<li v-for="(v, k) in corpus.metadata">
<strong>{{ k }}:</strong> {{ v }}
</li>
</ul>

<pre v-if="showPre"
class="corpus-pre">{{ JSON.stringify(corpus) }}</pre>
<hr>
</div>
<br>

<Paragraph v-if="corpus.paragraphs[cursor]"
:key="cursor"
Expand Down Expand Up @@ -258,4 +272,15 @@
max-width: 100%;
overflow: auto;
}
.pButtonsDiv {
width: 100%;
display: flex;
justify-content: space-between;
align-items: center;
}
.corpus_buttons_span {
width: 100%;
}
</style>
4 changes: 2 additions & 2 deletions src/tools/gsv5/v5_xml_to_json.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -203,13 +203,13 @@
},
{
"cell_type": "code",
"execution_count": 57,
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"corpus = {\n",
"\t\"version\": 5,\n",
"\t\"meatadata\": metadata,\n",
"\t\"metadata\": metadata,\n",
"\t\n",
"\t\"paragraphs\": paragraphs,\n",
"}\n",
Expand Down

0 comments on commit 6176bf0

Please sign in to comment.