|
130 | 130 | var docs_loaded = 1;
|
131 | 131 | var load_fail_reported = false;
|
132 | 132 | var loading_now = false;
|
133 |
| -add_show_tree_button = function(index, el){ } // to be redefined later if show_trees=True |
| 133 | +add_show_tree_button = function(index, el){ // to be redefined later if show_trees=True |
| 134 | + $(el).prepend('<span class="sent_id">🆔' + el.dataset.id + '</span>'); |
| 135 | +} |
134 | 136 | function load_more() {
|
135 | 137 | if (!loading_now && $(window).scrollTop() >= $(document).height() - $(window).height() - 42 && docs_loaded < all_docs) {
|
136 | 138 | docs_loaded += 1;
|
|
182 | 184 | })
|
183 | 185 | );
|
184 | 186 | }
|
185 |
| -
|
186 |
| -$("#doc1 .sentence").each(add_show_tree_button); |
187 | 187 | '''
|
188 | 188 |
|
189 | 189 | WRITE_HTML = udapi.block.write.html.Html()
|
@@ -213,7 +213,7 @@ def __init__(self, docs_dir='docs', path_to_js='web',
|
213 | 213 | def _representative_word(self, entity):
|
214 | 214 | # return the first PROPN or NOUN. Or the most frequent one?
|
215 | 215 | heads = [m.head for m in entity.mentions]
|
216 |
| - lemma_or_form = lambda n: n.lemma if n.lemma else n.form |
| 216 | + lemma_or_form = lambda n: n.lemma if n.lemma and n.lemma != '_' else n.form |
217 | 217 | for upos in ('PROPN', 'NOUN'):
|
218 | 218 | nodes = [n for n in heads if n.upos == upos]
|
219 | 219 | if nodes:
|
@@ -292,7 +292,7 @@ def process_document(self, doc):
|
292 | 292 | f' <input id="show-eid" type="checkbox" {"checked" if self.show_eid else ""} onclick="$(\'.eid\').toggle(this.checked);"><label for="show-eid">eid</label><br>\n'
|
293 | 293 | f' <input id="show-etype" type="checkbox" {"checked" if self.show_etype else ""} onclick="$(\'.etype\').toggle(this.checked);"><label for="show-etype">etype</label><br>\n'
|
294 | 294 | ' <input id="show-sent_id" type="checkbox" onclick="$(\'.sent_id\').toggle(this.checked);"><label for="show-sent_id">sent_id</label><br>\n'
|
295 |
| - ' <input id="show-trees" type="checkbox" checked onclick="$(\'.showtree\').toggle(this.checked);"><label for="show-trees">trees</label><br>\n' |
| 295 | + + (' <input id="show-trees" type="checkbox" checked onclick="$(\'.showtree\').toggle(this.checked);"><label for="show-trees">trees</label><br>\n' if self.show_trees else '') + |
296 | 296 | ' <input id="show-color" type="checkbox" checked onclick="$(\'.m\').toggleClass(\'nocolor\',!this.checked);"><label for="show-color">colors</label><br>\n'
|
297 | 297 | ' <input id="show-boxes" type="checkbox" checked onclick="$(\'.m\').toggleClass(\'nobox\',!this.checked);"><label for="show-boxes">boxes</label></div><div>\n'
|
298 | 298 | ' <input id="show-norm" type="checkbox" checked onclick="$(\'.norm\').toggle(this.checked);"><label for="show-norm">non-mentions</label><br>\n'
|
@@ -337,6 +337,7 @@ def process_document(self, doc):
|
337 | 337 | finally:
|
338 | 338 | sys.stdout = orig_stdout
|
339 | 339 | print(SCRIPT_SHOWTREE)
|
| 340 | + print('$("#doc1 .sentence").each(add_show_tree_button);') |
340 | 341 | print('</script>')
|
341 | 342 | print('</div></body></html>')
|
342 | 343 |
|
|
0 commit comments