-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
⟦lexicon.html⟧: Adding line breaks and replacing space intentation wi…
…th tabs.
- Loading branch information
Showing
1 changed file
with
94 additions
and
85 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,88 +1,97 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="UTF-8"> | ||
<title>Nahaıwa lexicon</title> | ||
<style type="text/css"> | ||
table { | ||
border-collapse: collapse; | ||
border: 1px solid black; | ||
} | ||
td { | ||
border: 1px solid black; | ||
padding: 3px; | ||
} | ||
</style> | ||
<script | ||
type="text/javascript" | ||
src="https://cdnjs.cloudflare.com/ajax/libs/d3/3.4.2/d3.js"> | ||
</script> | ||
<script type="text/javascript"> | ||
function is_array(v) { | ||
return Object.prototype.toString.call(v) === '[object Array]'; | ||
} | ||
function is_undefined(v) { | ||
return Object.prototype.toString.call(v) === '[object Undefined]'; | ||
} | ||
g_lexicon = []; | ||
</script> | ||
</head> | ||
<body> | ||
<input type="checkbox" id="sorting_checkbox" name="sorting_checkbox" checked=false onchange="proceed(g_lexicon);" /> | ||
<label for="sorting_checkbox">Sort by semantic category</label> | ||
<br /><br /> | ||
<span id="lexemes_stats"></span> | ||
<br /><br /> | ||
<div id="content">(LEXICON NOT YET LOADED!)</div> | ||
<script type="text/javascript"> | ||
function compare(a, b) { | ||
if(a === "") { | ||
return 1; | ||
} else if(b === "") { | ||
return -1; | ||
} else { | ||
return a < b ? -1 : a > b ? 1 : 0; | ||
} | ||
} | ||
function proceed(lexicon) { | ||
shall_sort_by_semantic_tags = | ||
document.getElementById("sorting_checkbox").checked; | ||
lexicon = lexicon.sort((a, b) => { | ||
if (shall_sort_by_semantic_tags) | ||
return ( | ||
a.type.localeCompare(b.type) | ||
|| compare(a.tags, b.tags) | ||
|| compare(a.morpheme, b.morpheme)) | ||
else | ||
return ( | ||
a.type.localeCompare(b.type) | ||
|| compare(a.morpheme, b.morpheme)) | ||
}); | ||
s = ""; | ||
lexicon.forEach((e, i, l) => { | ||
s += "<tr>\n"; | ||
s += "<td>" + e.morpheme + "</td>\n"; | ||
s += "<td>" + e.type + "</td>\n"; | ||
s += "<td>" + e.subtype + "</td>\n"; | ||
s += "<td>" + e.eng + "</td>\n"; | ||
s += "<td>" + e.tags + "</td>\n"; | ||
s += "<td>" + e.predilex_id + "</td>\n"; | ||
s += "</tr>\n"; | ||
}); | ||
content = "<table cellspacing='2px'>\n<thead>\n<td>Morpheme</td><td>Type</td><td>Subtype</td><td>Meaning</td><td>Tags</td><td>Predilex ID</td>\n</thead>\n<tbody>\n"; | ||
content += (s + "\n</tbody>\n</table>\n"); | ||
document.getElementById("content").innerHTML = content; | ||
n_roots = lexicon.filter(e => e.type === "root").length; | ||
n_extensions = lexicon.filter(e => e.type === "ext").length; | ||
document.getElementById('lexemes_stats').innerHTML = | ||
"Number of lexemes: " + (n_roots + n_extensions) + | ||
" (" + n_roots + " roots, " + n_extensions + | ||
" extensional prefixes)."; | ||
} | ||
d3.tsv("lexicon.tsv", (tsv) => { | ||
g_lexicon = tsv; | ||
proceed(tsv); | ||
}); | ||
</script> | ||
</body> | ||
<head> | ||
<meta charset="UTF-8"> | ||
<title>Nahaıwa lexicon</title> | ||
<style type="text/css"> | ||
table { | ||
border-collapse: collapse; | ||
border: 1px solid black; | ||
} | ||
td { | ||
border: 1px solid black; | ||
padding: 3px; | ||
} | ||
</style> | ||
<script | ||
type="text/javascript" | ||
src="https://cdnjs.cloudflare.com/ajax/libs/d3/3.4.2/d3.js"> | ||
</script> | ||
<script type="text/javascript"> | ||
function is_array(v) { | ||
return Object.prototype.toString.call(v) === '[object Array]'; | ||
} | ||
function is_undefined(v) { | ||
return Object.prototype.toString.call(v) === | ||
'[object Undefined]'; | ||
} | ||
g_lexicon = []; | ||
</script> | ||
</head> | ||
<body> | ||
<input | ||
type="checkbox" | ||
id="sorting_checkbox" | ||
name="sorting_checkbox" | ||
checked=false | ||
onchange="proceed(g_lexicon);" /> | ||
<label for="sorting_checkbox">Sort by semantic category</label> | ||
<br /><br /> | ||
<span id="lexemes_stats"></span> | ||
<br /><br /> | ||
<div id="content">(LEXICON NOT YET LOADED!)</div> | ||
<script type="text/javascript"> | ||
function compare(a, b) { | ||
if(a === "") { | ||
return 1; | ||
} else if(b === "") { | ||
return -1; | ||
} else { | ||
return a < b ? -1 : a > b ? 1 : 0; | ||
} | ||
} | ||
function proceed(lexicon) { | ||
shall_sort_by_semantic_tags = | ||
document.getElementById("sorting_checkbox").checked; | ||
lexicon = lexicon.sort((a, b) => { | ||
if (shall_sort_by_semantic_tags) | ||
return ( | ||
a.type.localeCompare(b.type) | ||
|| compare(a.tags, b.tags) | ||
|| compare(a.morpheme, b.morpheme)) | ||
else | ||
return ( | ||
a.type.localeCompare(b.type) | ||
|| compare(a.morpheme, b.morpheme)) | ||
}); | ||
s = ""; | ||
lexicon.forEach((e, i, l) => { | ||
s += "<tr>\n"; | ||
s += "<td>" + e.morpheme + "</td>\n"; | ||
s += "<td>" + e.type + "</td>\n"; | ||
s += "<td>" + e.subtype + "</td>\n"; | ||
s += "<td>" + e.eng + "</td>\n"; | ||
s += "<td>" + e.tags + "</td>\n"; | ||
s += "<td>" + e.predilex_id + "</td>\n"; | ||
s += "</tr>\n"; | ||
}); | ||
content = | ||
"<table cellspacing='2px'>\n<thead>\n<td>Morpheme</td>" + | ||
"<td>Type</td><td>Subtype</td><td>Meaning</td>" + | ||
"<td>Tags</td><td>Predilex ID</td>\n</thead>\n<tbody>\n"; | ||
content += (s + "\n</tbody>\n</table>\n"); | ||
document.getElementById("content").innerHTML = content; | ||
n_roots = lexicon.filter(e => e.type === "root").length; | ||
n_extensions = lexicon.filter(e => e.type === "ext").length; | ||
document.getElementById('lexemes_stats').innerHTML = | ||
"Number of lexemes: " + (n_roots + n_extensions) + | ||
" (" + n_roots + " roots, " + n_extensions + | ||
" extensional prefixes)."; | ||
} | ||
d3.tsv("lexicon.tsv", (tsv) => { | ||
g_lexicon = tsv; | ||
proceed(tsv); | ||
}); | ||
</script> | ||
</body> | ||
</html> |