Skip to content

Commit

Permalink
v0.7.3
Browse files Browse the repository at this point in the history
  • Loading branch information
Paul Strack committed Jul 28, 2019
1 parent e27f28d commit 51db6f1
Show file tree
Hide file tree
Showing 14 changed files with 17,669 additions and 6,498 deletions.
24,017 changes: 17,532 additions & 6,485 deletions src/data/eldamo-data.xml

Large diffs are not rendered by default.

76 changes: 76 additions & 0 deletions src/main/java/eldarin/parser/TranslationParser.java
@@ -0,0 +1,76 @@
package eldarin.parser;

import java.io.BufferedReader;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.io.UnsupportedEncodingException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

public class TranslationParser {

public static void main(String[] args) throws Exception {
List<List<String>> baseList = readFile("/Users/pfstrack/Desktop/base-polish.txt");
Map<String, List<String>> baseMap = new HashMap<String, List<String>>();
for (List<String> row : baseList) {
baseMap.put(row.get(0), row);
}
List<List<String>> export = readFile("/Users/pfstrack/Desktop/export-polish.txt");
for (List<String> row : export) {
List<String> baseRow = baseMap.get(row.get(0));
if (baseRow != null) {
row.add(baseRow.get(5));
if (!row.get(4).equals(baseRow.get(4))) {
row.add("English Updated");
}
}
}
PrintWriter writer = openWriter("/Users/pfstrack/Desktop/output.txt");
for (List<String> row : export) {
StringBuilder text = new StringBuilder();
for (String cell : row) {
text.append(cell).append('\t');
}
writer.println(text.toString());
}
writer.close();
}

private static List<List<String>> readFile(String file)
throws FileNotFoundException, UnsupportedEncodingException,
IOException {
BufferedReader br = openReader(file);
List<List<String>> data = new ArrayList<List<String>>();
String line = br.readLine();
while (line != null) {
List<String> cells = Arrays.asList(line.split("\t"));
List<String> row = new ArrayList<String>();
row.addAll(cells);
data.add(row);
line = br.readLine();
}
return data;
}

private static BufferedReader openReader(String path)
throws FileNotFoundException, UnsupportedEncodingException {
FileInputStream fis = new FileInputStream(path);
InputStreamReader isr = new InputStreamReader(fis, "UTF-8");
return new BufferedReader(isr);
}

private static PrintWriter openWriter(String path)
throws FileNotFoundException, UnsupportedEncodingException {
FileOutputStream fos = new FileOutputStream(path);
OutputStreamWriter osw = new OutputStreamWriter(fos, "UTF-8");
return new PrintWriter(osw);
}
}
8 changes: 7 additions & 1 deletion src/main/webapp/config/query-configs/common.xq
Expand Up @@ -139,6 +139,8 @@ declare function c:convert-lang($lang as xs:string?) as xs:string {
then 'ᴺ✶'
else if ($lang='mq')
then 'ᴹQ. '
else if ($lang='maq')
then 'ᴹAQ. '
else if ($lang='nq')
then 'ᴺQ. '
else if ($lang='mt')
Expand Down Expand Up @@ -494,7 +496,11 @@ declare function c:show-hierarchy-list($items as element()*, $grouping as xs:str
};

declare function c:alt-lang($word as element()) as xs:string {
let $alt := $word[not(@mark='!')][not($word/ref)][not(starts-with(@speech, 'phon') or @speech='grammar' or @speech='text')]//word[ref][1][@l][@l != $word/@l]
let $combine := if ($word/@mark='^')
then $word//word[combine/@l = $word/@l and combine/@v = $word/@v]/c:get-word(.)
else ()
let $alt := if ($combine) then ($combine[1])
else $word[not(@mark='!')][not($word/ref)][not(starts-with(@speech, 'phon') or @speech='grammar' or @speech='text')]//word[ref][1][@l][@l != $word/@l]
return if ($alt)
then translate(c:print-lang($alt[1]), ' ', '')
else ''
Expand Down
14 changes: 10 additions & 4 deletions src/main/webapp/config/query-configs/neologism-index.xq
Expand Up @@ -115,10 +115,13 @@ return (
<span> &lt; {c:print-word($word/deriv[1]/c:get-word(.), <control show-lang="y" show-link="y"/>)}</span>
else() }
{ if (contains($word/@mark, "^")) then
<span> « {
let $precursor := $word/word[deprecated/@l = $word/@l and deprecated/@v = $word/@v]/c:get-word(.) return
<span> {
let $combine := $word//word[combine/@l = $word/@l and combine/@v = $word/@v]/c:get-word(.)
let $precursor := if ($combine) then ($combine)
else $word/word[deprecated/@l = $word/@l and deprecated/@v = $word/@v]/c:get-word(.)
return
if (not($precursor)) then ''
else c:print-word($precursor[1], <control show-lang="y" show-link="y"/>)
else (' « ', c:print-word($precursor[1], <control show-lang="y" show-link="y"/>))
}</span>
else() }
{ if (not($word/@created or $word/@vetted)) then () else
Expand All @@ -130,7 +133,10 @@ return (
} </span>
, ']') }
{ if (contains($word/@mark, "^")) then
let $precursor := $word//word[deprecated/@l = $word/@l and deprecated/@v = $word/@v]/c:get-word(.) return
let $combine := $word//word[combine/@l = $word/@l and combine/@v = $word/@v]/c:get-word(.)
let $precursor := if ($combine) then ($combine)
else $word//word[deprecated/@l = $word/@l and deprecated/@v = $word/@v]/c:get-word(.)
return
if (not($precursor) and not($word/deprecated)) then ' ERROR:NO_PRECURSOR' else ()
else if (not($word/@mark)) then
let $combines := $word//word[combine/@l = $word/@l and combine/@v = $word/@v]/c:get-word(.) return
Expand Down
1 change: 1 addition & 0 deletions src/main/webapp/config/query-configs/reference-page.xq
Expand Up @@ -101,6 +101,7 @@ declare function local:show-word2(
else if ($lang='et') then text {'ᴱT. '}
else if ($lang='mt') then text {'ᴹT. '}
else if ($lang='aq') then text {'AQ. '}
else if ($lang='maq') then text {'ᴹAQ. '}
else if ($lang='at') then text {'AT. '}
else if ($lang='os') then text {'OS. '}
else if ($lang='edan') then text {'ED. '}
Expand Down
1 change: 1 addition & 0 deletions src/main/webapp/config/query-configs/search.xq
Expand Up @@ -140,6 +140,7 @@ button {{ border-radius: 4px; background-color: #EEE; border: 1px solid #444 }}
<option value="pron">pronoun</option>
<option value="prep">preposition</option>
<option value="conj">conjunction</option>
<option value="interj">interjection</option>
<option value="pref">prefix</option>
<option value="suf">suffix</option>
<option value="root">root</option>
Expand Down
2 changes: 1 addition & 1 deletion src/main/webapp/config/query-configs/sort-merge.xsl
Expand Up @@ -141,12 +141,12 @@
<xsl:when test="$word='on'">so</xsl:when>
<xsl:when test="$word='os'">so</xsl:when>
<xsl:when test="$word='eon'">os</xsl:when>
<xsl:when test="$word='eoq'">aq</xsl:when>
<xsl:when test="$word='eilk'">ilk</xsl:when>
<xsl:when test="$word='at'">t</xsl:when>
<xsl:when test="$word='mt'">t</xsl:when>
<xsl:when test="$word='et'">t</xsl:when>
<xsl:when test="$word='aq'">q</xsl:when>
<xsl:when test="$word='maq'">q</xsl:when>
<xsl:when test="$word='mq'">q</xsl:when>
<xsl:when test="$word='eq'">q</xsl:when>
<xsl:when test="$word='nq'">q</xsl:when>
Expand Down
2 changes: 1 addition & 1 deletion src/main/webapp/config/query-configs/sort.xsl
Expand Up @@ -131,12 +131,12 @@
<xsl:when test="$word='on'">so</xsl:when>
<xsl:when test="$word='os'">so</xsl:when>
<xsl:when test="$word='eon'">os</xsl:when>
<xsl:when test="$word='eoq'">aq</xsl:when>
<xsl:when test="$word='eilk'">ilk</xsl:when>
<xsl:when test="$word='at'">t</xsl:when>
<xsl:when test="$word='mt'">t</xsl:when>
<xsl:when test="$word='et'">t</xsl:when>
<xsl:when test="$word='aq'">q</xsl:when>
<xsl:when test="$word='maq'">q</xsl:when>
<xsl:when test="$word='mq'">q</xsl:when>
<xsl:when test="$word='eq'">q</xsl:when>
<xsl:when test="$word='nq'">q</xsl:when>
Expand Down
21 changes: 21 additions & 0 deletions src/main/webapp/config/query-configs/test.xq
@@ -0,0 +1,21 @@
import module namespace c = "common.xq" at "common.xq";

<html>
<body>
<table> {
let $words := //word[@l=('ns', 's', 'n', 'en', 'g')][not(see)]
[not(contains(@mark, '-'))][not(contains(@mark, '|'))]
[c:is-word(.)][not(@gloss='[unglossed]')][not(c:get-gloss(.) = '‽')][not(@cat)]
for $word in $words
let $cat := //cat[@id=$word/@cat]
order by c:normalize-for-sort($word/@v), $word/@l, xs:decimal($cat/@num)
return
<tr>
<td>{ c:get-lang($word) }</td>
<td>{ $word/@v/string() }</td>
<td>{ c:get-speech($word) }</td>
<td>{ c:get-gloss($word) }</td>
</tr>
} </table>
</body>
</html>
7 changes: 5 additions & 2 deletions src/main/webapp/config/query-configs/word-page.xq
Expand Up @@ -149,15 +149,18 @@ declare function local:print-derivations($word as element()?, $priors as element
let $deriv-mark := $deriv-link/@mark/string()
let $refs := $deriv-refs[xdb:key($word, 'ref', @source)[../@v = $deriv/@v]]
let $value := $deriv/@v/string()
let $is-neo := c:is-neo(c:get-word($deriv))
return
<li class="c-bullet">
<li>
{ attribute class { if ($is-neo) then 'neo c-bullet' else 'c-bullet' } }
&lt;
{c:print-word($deriv, <print-word show-lang="y" show-link="y"/>)}
{$deriv-mark}
{c:print-gloss($deriv)}
{local:print-ref-set($refs, <ref-set short-mode="{$pubmode}" v="{$value}" other-ref="y"/>)}
<ul>{(
for $ref in $refs[@i1 or . != ''] return
for $ref in $refs[@i1 or . != '']
return
<li style="list-style-type:none; text-indent: -1em;">{(
' &lt; ',
c:print-wordlet($ref/@i3, ' &lt; '),
Expand Down
2 changes: 2 additions & 0 deletions src/main/webapp/general/eldamo-schema.xsd
Expand Up @@ -344,6 +344,7 @@
<xs:enumeration value="plural-with-linking-consonant"/>
<xs:enumeration value="possessive-second"/>
<xs:enumeration value="pronoun-prefix"/>
<xs:enumeration value="prosodic-lengthening"/>
<xs:enumeration value="r-locative"/>
<xs:enumeration value="short-instrumental"/>
<xs:enumeration value="strong-I-without-syncope"/>
Expand Down Expand Up @@ -429,6 +430,7 @@
<xs:enumeration value="lin"/> <!-- Lindarin -->
<xs:enumeration value="ln"/> <!-- Late Noldorin -->
<xs:enumeration value="lon"/> <!-- Late Old Noldorin -->
<xs:enumeration value="maq"/> <!-- Middle Ancient Quenya -->
<xs:enumeration value="mp"/> <!-- Middle Primitive Elvish -->
<xs:enumeration value="mq"/> <!-- Middle Quenya -->
<xs:enumeration value="mt"/> <!-- Middle Telerin -->
Expand Down
1 change: 0 additions & 1 deletion src/main/webapp/general/getting-started.html
Expand Up @@ -24,7 +24,6 @@ <h1>Getting Started</h1>
<ul>
<li>Fiona Jalling’s <i><a href="https://academy.realelvish.net/store/">A Fan’s Guide to Neo-Sindarin</a></i></li>
<li>Thorsten Renk’s <i><a href="http://www.science-and-fiction.org/bookstore.html#pedin_edhellen">Pedin Edhellen</a></i></li>
<li>Xandarien’s <i><a href="http://sindarinlessons.weebly.com/">Sindarin Lessons</a></i></li>
</ul>
</li>
</ul>
Expand Down
8 changes: 7 additions & 1 deletion src/main/webapp/general/version-history.html
Expand Up @@ -10,7 +10,13 @@
<p>[<a href="../index.html">Home</a>]</p>
<hr>
<h1>Version History</h1>
<p>v0.7.2</p>
<p>v0.7.3</p>
<ul>
<li>Began analysis of Quenya phonetics: mostly basic research.</li>
<li>Added the Middle Ancient Quenya (ᴹAQ.) language.</li>
<li>Began collecting very minor sources: Auct-Let for Tolkien’s letters sold at auction.</li>
</ul>
<p>v0.7.2 (April 5, 2019)</p>
<ul>
<li>Analyzed Sindarin phonetics.</li>
</ul>
Expand Down
7 changes: 5 additions & 2 deletions src/main/webapp/translations/eldamo-polish.txt
@@ -1,7 +1,10 @@
# Polish translations of Eldamo glosses, based on Eldamo v0.6.5 by Paul Strack
#
# Polish translations of Eldamo glosses
# Tab-delimited file: first value is Eldamo page-id, second is Polish translation.
#
# v1 based on Eldamo v0.6.5 (Przemek Chorobiński)
# Source - https://docs.google.com/spreadsheets/d/1UHG_5mpudMAqT0-FcogcrN4H0RyVvft5p-9qJRVBuqc
# v2 based on Eldamo v0.7.3
# Source - https://docs.google.com/spreadsheets/d/1EcMH_PwEp7L7CQx-3dt4s2UNUszDsKmCqli9Tkk4WKg
#
# © 2018-2019, Przemek Chorobiński.
# This work is licensed under the Creative Commons Attribution 4.0 International License.
Expand Down

0 comments on commit 51db6f1

Please sign in to comment.