mirror of
https://gitlab.ub.uni-bielefeld.de/sfb1288inf/nopaque.git
synced 2024-11-14 16:55:42 +00:00
Sort Mechanics Text Info List
This commit is contained in:
parent
cc508cf4eb
commit
71359523ba
@ -138,8 +138,104 @@ class CQiCorpus {
|
||||
"publishing_year": 1950
|
||||
},
|
||||
{
|
||||
"num_tokens": 800, // number of tokens in the text
|
||||
"num_unique_words": 60, // number of unique words in the text
|
||||
"num_tokens": 15, // number of tokens in the text
|
||||
"num_unique_words": 4, // number of unique words in the text
|
||||
"word_freqs": { // frequency of unique words in the text (sorted by frequency)
|
||||
"str": "int", // number of tokens with word "str"
|
||||
// ...
|
||||
},
|
||||
"num_unique_lemmas": 90, // number of unique lemmas in the text
|
||||
"lemma_freqs": { // frequency of unique lemmas in the text (sorted by frequency)
|
||||
"str": "int", // number of tokens with lemma "str"
|
||||
// ...
|
||||
},
|
||||
"num_sentences": 11, // number of sentences in the text
|
||||
"average_sentence_length": 3, // average number of tokens per sentence in the text
|
||||
"num_ent_types": 4, // number of ent_types in the text
|
||||
"num_unique_ent_types": 300, // number of unique ent_types in the text
|
||||
"num_entities_by_id": {
|
||||
"1": "int", // number of entities with id 1
|
||||
// ...
|
||||
},
|
||||
"author": "Author Name",
|
||||
"title": "Titel 1",
|
||||
"publishing_year": 1962
|
||||
},
|
||||
{
|
||||
"num_tokens": 11, // number of tokens in the text
|
||||
"num_unique_words": 12, // number of unique words in the text
|
||||
"word_freqs": { // frequency of unique words in the text (sorted by frequency)
|
||||
"str": "int", // number of tokens with word "str"
|
||||
// ...
|
||||
},
|
||||
"num_unique_lemmas": 64, // number of unique lemmas in the text
|
||||
"lemma_freqs": { // frequency of unique lemmas in the text (sorted by frequency)
|
||||
"str": "int", // number of tokens with lemma "str"
|
||||
// ...
|
||||
},
|
||||
"num_sentences": 52, // number of sentences in the text
|
||||
"average_sentence_length": 3, // average number of tokens per sentence in the text
|
||||
"num_ent_types": 45, // number of ent_types in the text
|
||||
"num_unique_ent_types": 68, // number of unique ent_types in the text
|
||||
"num_entities_by_id": {
|
||||
"1": "int", // number of entities with id 1
|
||||
// ...
|
||||
},
|
||||
"author": "Author Name",
|
||||
"title": "Titel 2",
|
||||
"publishing_year": 1850
|
||||
},
|
||||
{
|
||||
"num_tokens": 56, // number of tokens in the text
|
||||
"num_unique_words": 13, // number of unique words in the text
|
||||
"word_freqs": { // frequency of unique words in the text (sorted by frequency)
|
||||
"str": "int", // number of tokens with word "str"
|
||||
// ...
|
||||
},
|
||||
"num_unique_lemmas": 43, // number of unique lemmas in the text
|
||||
"lemma_freqs": { // frequency of unique lemmas in the text (sorted by frequency)
|
||||
"str": "int", // number of tokens with lemma "str"
|
||||
// ...
|
||||
},
|
||||
"num_sentences": 45, // number of sentences in the text
|
||||
"average_sentence_length": 56, // average number of tokens per sentence in the text
|
||||
"num_ent_types": 8792, // number of ent_types in the text
|
||||
"num_unique_ent_types": 56758, // number of unique ent_types in the text
|
||||
"num_entities_by_id": {
|
||||
"1": "int", // number of entities with id 1
|
||||
// ...
|
||||
},
|
||||
"author": "Author Name",
|
||||
"title": "Titel 3",
|
||||
"publishing_year": 1504
|
||||
},
|
||||
{
|
||||
"num_tokens": 54345, // number of tokens in the text
|
||||
"num_unique_words": 561, // number of unique words in the text
|
||||
"word_freqs": { // frequency of unique words in the text (sorted by frequency)
|
||||
"str": "int", // number of tokens with word "str"
|
||||
// ...
|
||||
},
|
||||
"num_unique_lemmas": 546, // number of unique lemmas in the text
|
||||
"lemma_freqs": { // frequency of unique lemmas in the text (sorted by frequency)
|
||||
"str": "int", // number of tokens with lemma "str"
|
||||
// ...
|
||||
},
|
||||
"num_sentences": 5427, // number of sentences in the text
|
||||
"average_sentence_length": 657, // average number of tokens per sentence in the text
|
||||
"num_ent_types": 3465, // number of ent_types in the text
|
||||
"num_unique_ent_types": 45, // number of unique ent_types in the text
|
||||
"num_entities_by_id": {
|
||||
"1": "int", // number of entities with id 1
|
||||
// ...
|
||||
},
|
||||
"author": "Author Name",
|
||||
"title": "Titel 4",
|
||||
"publishing_year": 1712
|
||||
},
|
||||
{
|
||||
"num_tokens": 4354, // number of tokens in the text
|
||||
"num_unique_words": 45234, // number of unique words in the text
|
||||
"word_freqs": { // frequency of unique words in the text (sorted by frequency)
|
||||
"testwort": 50, // number of tokens with word "str"
|
||||
"testwort2": 1
|
||||
@ -158,7 +254,7 @@ class CQiCorpus {
|
||||
// ...
|
||||
},
|
||||
"author": "Author Name 2",
|
||||
"title": "Titel 2",
|
||||
"title": "Titel 5",
|
||||
"publishing_year": 1951
|
||||
}
|
||||
]
|
||||
|
@ -17,6 +17,10 @@ class CorpusTextInfoList extends ResourceList {
|
||||
);
|
||||
super(listContainerElement, _options);
|
||||
this.isInitialized = false;
|
||||
let sortElements = this.listContainerElement.querySelectorAll('.sort');
|
||||
sortElements.forEach((sortElement) => {
|
||||
sortElement.addEventListener('click', (event) => {this.renderSortElement(sortElement)});
|
||||
});
|
||||
}
|
||||
|
||||
get item() {
|
||||
@ -29,7 +33,6 @@ class CorpusTextInfoList extends ResourceList {
|
||||
<td><span class="num_unique_lemmas"></span></td>
|
||||
<td><span class="num_sentences"></span></td>
|
||||
<td><span class="average_sentence_length"></span></td>
|
||||
<td><span class="num_ent_types"></span></td>
|
||||
<td><span class="num_unique_ent_types"></span></td>
|
||||
</tr>
|
||||
`.trim();
|
||||
@ -45,7 +48,6 @@ class CorpusTextInfoList extends ResourceList {
|
||||
'num_unique_lemmas',
|
||||
'num_sentences',
|
||||
'average_sentence_length',
|
||||
'num_ent_types',
|
||||
'num_unique_ent_types'
|
||||
];
|
||||
}
|
||||
@ -64,14 +66,13 @@ class CorpusTextInfoList extends ResourceList {
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Text</th>
|
||||
<th>Number of tokens</th>
|
||||
<th>Number of unique words</th>
|
||||
<th>Number of unique lemmas</th>
|
||||
<th>Number of sentences</th>
|
||||
<th>Average sentence length</th>
|
||||
<th>Number of entity types</th>
|
||||
<th>Number of unique entity types</th>
|
||||
<th>Text<span class="sort right material-icons" data-sort="title" style="cursor:pointer; color:#aa9cc9">arrow_drop_down</span></th>
|
||||
<th>Number of tokens<span class="sort right material-icons" data-sort="num_tokens" style="cursor:pointer">arrow_drop_down</span></th>
|
||||
<th>Number of unique words<span class="sort right material-icons" data-sort="num_unique_words" style="cursor:pointer">arrow_drop_down</span></th>
|
||||
<th>Number of unique lemmas<span class="sort right material-icons" data-sort="num_unique_lemmas" style="cursor:pointer">arrow_drop_down</span></th>
|
||||
<th>Number of sentences<span class="sort right material-icons" data-sort="num_sentences" style="cursor:pointer">arrow_drop_down</span></th>
|
||||
<th>Average sentence length<span class="sort right material-icons" data-sort="average_sentence_length" style="cursor:pointer">arrow_drop_down</span></th>
|
||||
<th>Number of unique entity types<span class="sort right material-icons" data-sort="num_unique_ent_types" style="cursor:pointer">arrow_drop_down</span></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody class="list"></tbody>
|
||||
@ -81,7 +82,6 @@ class CorpusTextInfoList extends ResourceList {
|
||||
}
|
||||
|
||||
mapResourceToValue(corpusTextData) {
|
||||
console.log(corpusTextData);
|
||||
return {
|
||||
title: corpusTextData.title,
|
||||
publishing_year: corpusTextData.publishing_year,
|
||||
@ -90,8 +90,22 @@ class CorpusTextInfoList extends ResourceList {
|
||||
num_unique_lemmas: corpusTextData.num_unique_lemmas,
|
||||
num_sentences: corpusTextData.num_sentences,
|
||||
average_sentence_length: corpusTextData.average_sentence_length,
|
||||
num_ent_types: corpusTextData.num_ent_types,
|
||||
num_unique_ent_types: corpusTextData.num_unique_ent_types
|
||||
};
|
||||
}
|
||||
|
||||
sort() {
|
||||
this.listjs.sort('title');
|
||||
}
|
||||
|
||||
renderSortElement(clickedSortElement) {
|
||||
this.listContainerElement.querySelectorAll('.sort').forEach((sortElement) => {
|
||||
if (sortElement !== clickedSortElement) {
|
||||
sortElement.classList.remove('asc', 'desc');
|
||||
sortElement.style.color = 'black';
|
||||
};
|
||||
});
|
||||
clickedSortElement.style.color = '#aa9cc9';
|
||||
clickedSortElement.innerHTML = clickedSortElement.classList.contains('asc') ? 'arrow_drop_down' : 'arrow_drop_up';
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user