Christian Fraß commited on 2016-08-08 21:50:25
Zeige 9 geänderte Dateien mit 203 Einfügungen und 295 Löschungen.
... | ... |
@@ -121,7 +121,6 @@ def main(): |
121 | 121 |
os.path.join(dirs["source"],"data","timeforms.json"), |
122 | 122 |
os.path.join(dirs["source"],"data","adpositions.json"), |
123 | 123 |
os.path.join(dirs["source"],"data","correlatives.json"), |
124 |
- os.path.join(dirs["source"],"data","x.json"), |
|
125 | 124 |
] |
126 | 125 |
|
127 | 126 |
parts_logic_client = [ |
... | ... |
@@ -9,7 +9,7 @@ clear: clean |
9 | 9 |
@ rm --recursive --force build |
10 | 10 |
.PHONY: clear |
11 | 11 |
|
12 |
-build/draft.html: source/data/phonology_and_orthography.json source/data/personal_pronouns.json source/data/word_functions.json source/data/timeforms.json source/data/adpositions.json source/data/correlatives.json source/data/x.json source/logic/server/misc.php source/logic/server/data.php source/logic/server/settings.php source/logic/server/table.php source/logic/server/sql.php source/content/draft.html.php source/content/meta.html.php source/content/introduction.html.php source/content/preface.html.php source/content/key_parameters.html.php source/content/toc.html.php source/content/basics.html.php source/content/phonology_and_orthography.html.php source/content/grammar.html.php source/content/personal_pronouns.html.php source/content/correlatives.html.php source/content/conjugation.html.php source/content/infinite_verbforms.html.php source/content/modal_verbs.html.php source/content/tempora_and_modi.html.php source/content/negation.html.php source/content/declension.html.php source/content/numeri.html.php source/content/cases.html.php source/content/definiteness.html.php source/content/attributes.html.php source/content/sentence_structure.html.php source/content/vocabulary.html.php source/content/principles.html.php source/content/word_functions.html.php source/content/adpositions.html.php source/content/pronouns.html.php source/content/dictionary.html.php source/content/examples.html.php source/content/example_sentences.html.php source/content/example_texts.html.php |
|
12 |
+build/draft.html: source/data/phonology_and_orthography.json source/data/personal_pronouns.json source/data/word_functions.json source/data/timeforms.json source/data/adpositions.json source/data/correlatives.json source/logic/server/misc.php source/logic/server/data.php source/logic/server/settings.php source/logic/server/table.php source/logic/server/sql.php source/content/draft.html.php source/content/meta.html.php source/content/introduction.html.php source/content/preface.html.php source/content/key_parameters.html.php source/content/toc.html.php source/content/basics.html.php source/content/phonology_and_orthography.html.php source/content/grammar.html.php source/content/personal_pronouns.html.php source/content/correlatives.html.php source/content/conjugation.html.php source/content/infinite_verbforms.html.php source/content/modal_verbs.html.php source/content/tempora_and_modi.html.php source/content/negation.html.php source/content/declension.html.php source/content/numeri.html.php source/content/cases.html.php source/content/definiteness.html.php source/content/attributes.html.php source/content/sentence_structure.html.php source/content/vocabulary.html.php source/content/principles.html.php source/content/word_functions.html.php source/content/adpositions.html.php source/content/pronouns.html.php source/content/dictionary.html.php source/content/examples.html.php source/content/example_sentences.html.php source/content/example_texts.html.php |
|
13 | 13 |
@ echo -e '-- composing document ...' |
14 | 14 |
@ mkdir --parents build |
15 | 15 |
@ php source/content/draft.html.php > build/draft.html |
... | ... |
@@ -10,51 +10,77 @@ |
10 | 10 |
<p>The following list gives an overview over prepositions:</p> |
11 | 11 |
--> |
12 | 12 |
<?php |
13 |
+ $data_adpositions = read_json("source/data/adpositions.json"); |
|
14 |
+ $data = $data_adpositions["words"]; |
|
15 |
+ { |
|
16 |
+ { |
|
17 |
+ $data = sql_cross($data, $data_adpositions["situations"]); |
|
18 |
+ $data = sql_select($data, function ($row) {return ($row["situation_id"] == $row["id"]);}); |
|
19 |
+ $data = sql_delete($data, ["situation_id", "id"]); |
|
20 |
+ $data = sql_rename($data, "name", "situation_name"); |
|
21 |
+ } |
|
22 |
+ { |
|
23 |
+ $data = sql_cross($data, $data_adpositions["types"]); |
|
24 |
+ $data = sql_select($data, function ($row) {return ($row["type_id"] == $row["id"]);}); |
|
25 |
+ $data = sql_delete($data, ["type_id", "id"]); |
|
26 |
+ $data = sql_rename($data, "name", "type_name"); |
|
27 |
+ } |
|
28 |
+ { |
|
29 |
+ $data = sql_cross($data, $data_adpositions["kinds"]); |
|
30 |
+ $data = sql_select($data, function ($row) {return ($row["kind_id"] == $row["id"]);}); |
|
31 |
+ $data = sql_delete($data, ["kind_id", "id"]); |
|
32 |
+ $data = sql_rename($data, "name", "kind_name"); |
|
33 |
+ } |
|
34 |
+ } |
|
35 |
+ |
|
13 | 36 |
$table = new class_table |
14 | 37 |
( |
15 | 38 |
[ |
16 |
- /* |
|
17 |
- new class_column |
|
39 |
+ new class_column("Language", "language_id"), |
|
40 |
+ new class_column("Situation", "situation_name"), |
|
41 |
+ new class_column("Type", "type_name"), |
|
42 |
+ new class_column("Kind", "kind_name"), |
|
43 |
+ new class_column("Words", "words", function ($x) {return json_encode($x);}), |
|
44 |
+ ], |
|
45 |
+ $data |
|
46 |
+ ); |
|
47 |
+ $table = $table->snap |
|
18 | 48 |
( |
19 |
- "Type", |
|
20 |
- function ($row) |
|
49 |
+ [ |
|
50 |
+ "label_vertical" => function ($column) {return "";}, |
|
51 |
+ "columns_vertical" => |
|
52 |
+ [ |
|
53 |
+ $table->columns_get()[1], |
|
54 |
+ ], |
|
55 |
+ "label_horizontal" => function ($column, $value) {return $value;}, |
|
56 |
+ "columns_horizontal" => |
|
57 |
+ [ |
|
58 |
+ $table->columns_get()[2], |
|
59 |
+ $table->columns_get()[3], |
|
60 |
+ ], |
|
61 |
+ "columns_data" => |
|
62 |
+ [ |
|
63 |
+ $table->columns_get()[0], |
|
64 |
+ $table->columns_get()[4], |
|
65 |
+ ], |
|
66 |
+ "data_aggregator" => function ($values) |
|
21 | 67 |
{ |
22 |
- return $row["type"]; |
|
23 |
- } |
|
24 |
- ), |
|
25 |
- */ |
|
26 |
- new class_column |
|
27 |
- ( |
|
28 |
- "Positive absolute", |
|
29 |
- _foo("positive_absolute"), |
|
30 |
- _bar("word") |
|
31 |
- ), |
|
32 |
- new class_column |
|
33 |
- ( |
|
34 |
- "Positive relative", |
|
35 |
- _foo("positive_relative"), |
|
36 |
- _bar("word") |
|
37 |
- ), |
|
38 |
- new class_column |
|
39 |
- ( |
|
40 |
- "Positive attributive", |
|
41 |
- _foo("positive_attributive"), |
|
42 |
- _bar("word") |
|
43 |
- ), |
|
44 |
- new class_column |
|
45 |
- ( |
|
46 |
- "Directive absolute", |
|
47 |
- _foo("directive_absolute"), |
|
68 |
+ return $values; |
|
69 |
+ }, |
|
70 |
+ "data_formatter" => function ($value) |
|
71 |
+ { |
|
72 |
+ return ( |
|
48 | 73 |
_bar("word") |
49 |
- ), |
|
50 |
- new class_column |
|
51 | 74 |
( |
52 |
- "Directive relative", |
|
53 |
- _foo("directive_relative"), |
|
54 |
- _bar("word") |
|
55 |
- ), |
|
56 |
- ], |
|
57 |
- read_json("source/data/adpositions.json") |
|
75 |
+ [ |
|
76 |
+ "original" => $value[0]["words"], |
|
77 |
+ "translated" => $value[1]["words"], |
|
78 |
+ ] |
|
79 |
+ ) |
|
80 |
+ ); |
|
81 |
+ return json_encode($value); |
|
82 |
+ }, |
|
83 |
+ ] |
|
58 | 84 |
); |
59 | 85 |
$table->generate(); |
60 | 86 |
?> |
... | ... |
@@ -8,181 +8,70 @@ |
8 | 8 |
<header>Correlatives</header> |
9 | 9 |
<?php proposal(); ?> |
10 | 10 |
<?php |
11 |
- $mode = 0; |
|
12 |
- switch ($mode) |
|
11 |
+ $data_correlatives = read_json("source/data/correlatives.json"); |
|
12 |
+ $data = $data_correlatives["words"]; |
|
13 | 13 |
{ |
14 |
- case 0: |
|
15 | 14 |
{ |
16 |
- $table = new class_table |
|
17 |
- ( |
|
18 |
- [ |
|
19 |
- new class_column |
|
20 |
- ( |
|
21 |
- "Domain", |
|
22 |
- function ($row) {return $row["domain"];} |
|
23 |
- ), |
|
24 |
- new class_column |
|
25 |
- ( |
|
26 |
- "Interrogative / Relative", |
|
27 |
- _foo("interrogative"), |
|
28 |
- _bar("word") |
|
29 |
- ), |
|
30 |
- new class_column |
|
31 |
- ( |
|
32 |
- "Demonstrative far", |
|
33 |
- _foo("demonstrative_far"), |
|
34 |
- _bar("word") |
|
35 |
- ), |
|
36 |
- new class_column |
|
37 |
- ( |
|
38 |
- "Demonstrative near", |
|
39 |
- _foo("demonstrative_near"), |
|
40 |
- _bar("word") |
|
41 |
- ), |
|
42 |
- new class_column |
|
43 |
- ( |
|
44 |
- "Universal", |
|
45 |
- _foo("universal"), |
|
46 |
- _bar("word") |
|
47 |
- ), |
|
48 |
- new class_column |
|
49 |
- ( |
|
50 |
- "Undefined", |
|
51 |
- _foo("undefined"), |
|
52 |
- _bar("word") |
|
53 |
- ), |
|
54 |
- new class_column |
|
55 |
- ( |
|
56 |
- "Negative", |
|
57 |
- _foo("negative"), |
|
58 |
- _bar("word") |
|
59 |
- ), |
|
60 |
- ], |
|
61 |
- read_json("source/data/correlatives.json") |
|
62 |
- ); |
|
63 |
- $table->generate(); |
|
64 |
- break; |
|
65 |
- } |
|
66 |
- case 1: |
|
67 |
- { |
|
68 |
- global $configuration; |
|
69 |
- $database = read_json("source/data/x.json"); |
|
70 |
- $data = $database["words"]; |
|
71 |
- // $data = sql_cross($database["words"], sql_rename($database["words"])); |
|
72 |
- $data = sql_select($data, function ($row) {return ($row["language"] == "fs");}); |
|
73 |
- $table = new class_table |
|
74 |
- ( |
|
75 |
- [ |
|
76 |
- new class_column("Domain (id)", function ($row) {return $row["domain_id"];}), |
|
77 |
- new class_column("Type (id)", function ($row) {return $row["type_id"];}), |
|
78 |
- new class_column |
|
79 |
- ( |
|
80 |
- "Folksprak", |
|
81 |
- function ($row) {return $row["words"];}, |
|
82 |
- function ($value) {global $configuration; return _baz($value, "word", "fs");} |
|
83 |
- ), |
|
84 |
- /* |
|
85 |
- new class_column |
|
86 |
- ( |
|
87 |
- $configuration["languagemap"][$configuration["target"]], |
|
88 |
- function ($row) {global $configuration; return $row["words"][$configuration["target"]];}, |
|
89 |
- function ($value) {global $configuration; return _baz($value, "word", $configuration["target"]);} |
|
90 |
- ), |
|
91 |
- */ |
|
92 |
- ], |
|
93 |
- $data |
|
94 |
- ); |
|
95 |
- $table->generate(); |
|
96 |
- break; |
|
97 |
- } |
|
98 |
- case 2: |
|
99 |
- { |
|
100 |
- global $configuration; |
|
101 |
- $database = read_json("source/data/x.json"); |
|
102 |
- $data = $database["words"]; |
|
103 |
- |
|
104 |
- // get domain names |
|
105 |
- { |
|
106 |
- $data = sql_cross($data, $database["domains"]); |
|
15 |
+ $data = sql_cross($data, $data_correlatives["domains"]); |
|
16 |
+ $data = sql_select($data, function ($row) {return ($row["domain_id"] == $row["id"]);}); |
|
17 |
+ $data = sql_delete($data, ["domain_id", "id"]); |
|
107 | 18 |
$data = sql_rename($data, "name", "domain_name"); |
108 |
- $data = sql_select($data, function ($row) {return ($row["id"] == $row["domain_id"]);}); |
|
109 |
- $data = sql_delete($data, ["id"]); |
|
110 | 19 |
} |
111 |
- |
|
112 |
- // get type names |
|
113 | 20 |
{ |
114 |
- $data = sql_cross($data, $database["types"]); |
|
21 |
+ $data = sql_cross($data, $data_correlatives["types"]); |
|
22 |
+ $data = sql_select($data, function ($row) {return ($row["type_id"] == $row["id"]);}); |
|
23 |
+ $data = sql_delete($data, ["type_id", "id"]); |
|
115 | 24 |
$data = sql_rename($data, "name", "type_name"); |
116 |
- $data = sql_select($data, function ($row) {return ($row["id"] == $row["type_id"]);}); |
|
117 |
- $data = sql_delete($data, ["id"]); |
|
118 |
- } |
|
119 |
- |
|
120 |
- // transform |
|
121 |
- { |
|
122 |
- $data = sql_select($data, function ($row) {global $configuration; return (($row["language"] == "fs") or ($row["language"] == $configuration["target"]));}); |
|
123 |
- // $data = sql_group($data, "language"); |
|
124 |
- $data = sql_add($data, ["type_name/words"], ["type_name/words" => function ($row) {return ["key" => $row["type_id"], "value" => [$row["language"] => $row["words"]]];}]); |
|
125 |
- $data = sql_project($data, ["domain_name", "type_name/words"]); |
|
126 |
- $data = sql_group |
|
127 |
- ( |
|
128 |
- $data, |
|
129 |
- "domain_name", |
|
130 |
- [ |
|
131 |
- "type_name/words" => function ($args) |
|
132 |
- { |
|
133 |
- $output = []; |
|
134 |
- foreach ($args as $arg) |
|
135 |
- { |
|
136 |
- if (! array_key_exists($arg["key"], $output)) $output[$arg["key"]] = []; |
|
137 |
- foreach ($arg["value"] as $key => $value) |
|
138 |
- { |
|
139 |
- $output[$arg["key"]][$key] = $value; |
|
140 | 25 |
} |
141 | 26 |
} |
142 |
- return $output; |
|
143 |
- }, |
|
144 |
- ] |
|
145 |
- ); |
|
146 |
- } |
|
147 | 27 |
|
148 | 28 |
$table = new class_table |
149 |
- ( |
|
150 |
- array_merge |
|
151 | 29 |
( |
152 | 30 |
[ |
153 |
- new class_column("Domain", function ($row) {return $row["domain_name"];}), |
|
154 |
- // new class_column("type_name/words", function ($row) {return $row["type_name/words"];}, function ($value) {print_r($value);}), |
|
31 |
+ new class_column("Language", "language_id"), |
|
32 |
+ new class_column("Domain", "domain_name"), |
|
33 |
+ new class_column("Type", "type_name"), |
|
34 |
+ new class_column("Words", "words", function ($x) {return json_encode($x);}), |
|
155 | 35 |
], |
156 |
- array_map |
|
157 |
- ( |
|
158 |
- function ($type) |
|
159 |
- { |
|
160 |
- return ( |
|
161 |
- new class_column |
|
36 |
+ $data |
|
37 |
+ ); |
|
38 |
+ $table = $table->snap |
|
162 | 39 |
( |
163 |
- ("Type: " . $type["name"]), |
|
164 |
- function ($row) use (&$type) |
|
40 |
+ [ |
|
41 |
+ "label_vertical" => function ($column) {return "";}, |
|
42 |
+ "columns_vertical" => |
|
43 |
+ [ |
|
44 |
+ $table->columns_get()[1], |
|
45 |
+ ], |
|
46 |
+ "label_horizontal" => function ($column, $value) {return $value;}, |
|
47 |
+ "columns_horizontal" => |
|
48 |
+ [ |
|
49 |
+ $table->columns_get()[2], |
|
50 |
+ ], |
|
51 |
+ "columns_data" => |
|
52 |
+ [ |
|
53 |
+ $table->columns_get()[3], |
|
54 |
+ ], |
|
55 |
+ "data_aggregator" => function ($values) |
|
165 | 56 |
{ |
166 |
- global $configuration; |
|
167 |
- return ["original" => $row["type_name/words"][$type["id"]]["fs"], "translated" => $row["type_name/words"][$type["id"]][$configuration["target"]]]; |
|
57 |
+ return $values; |
|
168 | 58 |
}, |
59 |
+ "data_formatter" => function ($value) |
|
60 |
+ { |
|
61 |
+ return ( |
|
169 | 62 |
_bar("word") |
63 |
+ ( |
|
64 |
+ [ |
|
65 |
+ "original" => $value[0]["words"], |
|
66 |
+ "translated" => $value[1]["words"], |
|
67 |
+ ] |
|
170 | 68 |
) |
171 | 69 |
); |
70 |
+ return json_encode($value); |
|
172 | 71 |
}, |
173 |
- array_filter($database["types"], function ($type) {return ($type["id"] != "relative");}) |
|
174 |
- ) |
|
175 |
- ), |
|
176 |
- $data |
|
72 |
+ ] |
|
177 | 73 |
); |
178 | 74 |
$table->generate(); |
179 |
- break; |
|
180 |
- } |
|
181 |
- default: |
|
182 |
- { |
|
183 |
- break; |
|
184 |
- } |
|
185 |
- } |
|
186 | 75 |
?> |
187 | 76 |
<div class="note_information">Some of these words are very unlikely to ever get used (e.g. <span class="word lang_fs">ing slag</span>). Nevertheless they exist and are listed for completeness.</div> |
188 | 77 |
</section> |
... | ... |
@@ -14,32 +14,32 @@ |
14 | 14 |
<?php |
15 | 15 |
$data = [ |
16 | 16 |
[ |
17 |
- "nominative", |
|
18 |
- ["original" => ["en dag"], "translated" => ["a day"]], |
|
19 |
- ["original" => ["de dag"], "translated" => ["the day"]], |
|
20 |
- ["original" => ["dager"], "translated" => ["days"]], |
|
21 |
- ["original" => ["de dager"], "translated" => ["the days"]], |
|
17 |
+ "x0" => "nominative", |
|
18 |
+ "x1" => ["original" => ["en dag"], "translated" => ["a day"]], |
|
19 |
+ "x2" => ["original" => ["de dag"], "translated" => ["the day"]], |
|
20 |
+ "x3" => ["original" => ["dager"], "translated" => ["days"]], |
|
21 |
+ "x4" => ["original" => ["de dager"], "translated" => ["the days"]], |
|
22 | 22 |
], |
23 | 23 |
[ |
24 |
- "accusative", |
|
25 |
- ["original" => ["en dag"], "translated" => ["a day"]], |
|
26 |
- ["original" => ["de dag"], "translated" => ["the day"]], |
|
27 |
- ["original" => ["dager"], "translated" => ["days"]], |
|
28 |
- ["original" => ["de dager"], "translated" => ["the days"]], |
|
24 |
+ "x0" => "accusative", |
|
25 |
+ "x1" => ["original" => ["en dag"], "translated" => ["a day"]], |
|
26 |
+ "x2" => ["original" => ["de dag"], "translated" => ["the day"]], |
|
27 |
+ "x3" => ["original" => ["dager"], "translated" => ["days"]], |
|
28 |
+ "x4" => ["original" => ["de dager"], "translated" => ["the days"]], |
|
29 | 29 |
], |
30 | 30 |
[ |
31 |
- "dative", |
|
32 |
- ["original" => ["to en dag"], "translated" => ["(to) a day"]], |
|
33 |
- ["original" => ["to de dag"], "translated" => ["(to) the day"]], |
|
34 |
- ["original" => ["to dager"], "translated" => ["(to) days"]], |
|
35 |
- ["original" => ["to de dager"], "translated" => ["(to) the days"]], |
|
31 |
+ "x0" => "dative", |
|
32 |
+ "x1" => ["original" => ["to en dag"], "translated" => ["(to) a day"]], |
|
33 |
+ "x2" => ["original" => ["to de dag"], "translated" => ["(to) the day"]], |
|
34 |
+ "x3" => ["original" => ["to dager"], "translated" => ["(to) days"]], |
|
35 |
+ "x4" => ["original" => ["to de dager"], "translated" => ["(to) the days"]], |
|
36 | 36 |
], |
37 | 37 |
[ |
38 |
- "genitive", |
|
39 |
- ["original" => ["en dag(e)s","av en dag"], "translated" => ["a days","of a day"]], |
|
40 |
- ["original" => ["de dag(e)s","av de dag"], "translated" => ["the days","of the day"]], |
|
41 |
- ["original" => ["dager(e)s","av dager"], "translated" => ["days'","of days"]], |
|
42 |
- ["original" => ["de dager(e)s","av de dager"], "translated" => ["the days'","of the days"]], |
|
38 |
+ "x0" => "genitive", |
|
39 |
+ "x1" => ["original" => ["en dag(e)s","av en dag"], "translated" => ["a days","of a day"]], |
|
40 |
+ "x2" => ["original" => ["de dag(e)s","av de dag"], "translated" => ["the days","of the day"]], |
|
41 |
+ "x3" => ["original" => ["dager(e)s","av dager"], "translated" => ["days'","of days"]], |
|
42 |
+ "x4" => ["original" => ["de dager(e)s","av de dager"], "translated" => ["the days'","of the days"]], |
|
43 | 43 |
], |
44 | 44 |
]; |
45 | 45 |
(new class_table |
... | ... |
@@ -48,30 +48,30 @@ $data = [ |
48 | 48 |
new class_column |
49 | 49 |
( |
50 | 50 |
"Case", |
51 |
- function ($row) {return $row[0];} |
|
51 |
+ "x0" |
|
52 | 52 |
), |
53 | 53 |
new class_column |
54 | 54 |
( |
55 | 55 |
"singular indefinite", |
56 |
- function ($row) {return $row[1];}, |
|
56 |
+ "x1", |
|
57 | 57 |
_bar("word") |
58 | 58 |
), |
59 | 59 |
new class_column |
60 | 60 |
( |
61 | 61 |
"singular definite", |
62 |
- function ($row) {return $row[2];}, |
|
62 |
+ "x2", |
|
63 | 63 |
_bar("word") |
64 | 64 |
), |
65 | 65 |
new class_column |
66 | 66 |
( |
67 | 67 |
"plural indefinite", |
68 |
- function ($row) {return $row[3];}, |
|
68 |
+ "x3", |
|
69 | 69 |
_bar("word") |
70 | 70 |
), |
71 | 71 |
new class_column |
72 | 72 |
( |
73 | 73 |
"plural definite", |
74 |
- function ($row) {return $row[4];}, |
|
74 |
+ "x4", |
|
75 | 75 |
_bar("word") |
76 | 76 |
), |
77 | 77 |
], |
... | ... |
@@ -4,15 +4,17 @@ include_once("source/logic/server/data.php"); |
4 | 4 |
include_once("source/logic/server/sql.php"); |
5 | 5 |
include_once("source/logic/server/table.php"); |
6 | 6 |
|
7 |
+/* |
|
7 | 8 |
function convert_persona($persona) {return [0 => "impersonal", 1 => "1st person", 2 => "2nd person", 3 => "3rd person"][$persona];} |
8 | 9 |
function convert_numerus($numerus) {return [0 => null, 1 => "singular", 2 => "plural"][$numerus];} |
9 | 10 |
function convert_genus($genus) {return [0 => "common", 1 => "masculine", 2 => "feminine", 3 => "neuter"][$genus];} |
11 |
+ */ |
|
10 | 12 |
?> |
11 | 13 |
<section class="subsection" id="personal_pronouns"> |
12 | 14 |
<header>Personal Pronouns</header> |
13 | 15 |
<?php |
14 |
- $data_common = read_json("../../data/common.json"); |
|
15 |
- $data_pronouns = read_json("../../data/personal_pronouns.json"); |
|
16 |
+ $data_common = read_json("source/data/common.json"); |
|
17 |
+ $data_pronouns = read_json("source/data/personal_pronouns.json"); |
|
16 | 18 |
|
17 | 19 |
$data = $data_pronouns["words"]; |
18 | 20 |
{ |
... | ... |
@@ -36,15 +38,21 @@ function convert_genus($genus) {return [0 => "common", 1 => "masculine", 2 => "f |
36 | 38 |
} |
37 | 39 |
{ |
38 | 40 |
$data = sql_cross($data, $data_pronouns["types"]); |
41 |
+ /* |
|
39 | 42 |
$data = sql_select($data, function ($row) {return ($row["type_id"] == $row["id"]);}); |
40 | 43 |
$data = sql_delete($data, ["type_id", "id"]); |
41 | 44 |
$data = sql_rename($data, "name", "type_name"); |
45 |
+ */ |
|
46 |
+ $data = sql_rename($data, "type_id", "type_name"); |
|
42 | 47 |
} |
43 | 48 |
{ |
44 | 49 |
$data = sql_cross($data, $data_common["cases"]); |
50 |
+ /* |
|
45 | 51 |
$data = sql_select($data, function ($row) {return ($row["case_id"] == $row["id"]);}); |
46 | 52 |
$data = sql_delete($data, ["case_id", "id"]); |
47 | 53 |
$data = sql_rename($data, "name", "case_name"); |
54 |
+ */ |
|
55 |
+ $data = sql_rename($data, "case_id", "case_name"); |
|
48 | 56 |
} |
49 | 57 |
} |
50 | 58 |
|
... | ... |
@@ -68,15 +76,15 @@ function convert_genus($genus) {return [0 => "common", 1 => "masculine", 2 => "f |
68 | 76 |
"label_vertical" => function ($column) {return "";}, |
69 | 77 |
"columns_vertical" => |
70 | 78 |
[ |
71 |
- $table->columns_get()[4], |
|
72 |
- $table->columns_get()[5], |
|
79 |
+ $table->columns_get()[1], |
|
80 |
+ $table->columns_get()[2], |
|
81 |
+ $table->columns_get()[3], |
|
73 | 82 |
], |
74 | 83 |
"label_horizontal" => function ($column, $value) {return $value;}, |
75 | 84 |
"columns_horizontal" => |
76 | 85 |
[ |
77 |
- $table->columns_get()[1], |
|
78 |
- $table->columns_get()[2], |
|
79 |
- $table->columns_get()[3], |
|
86 |
+ $table->columns_get()[4], |
|
87 |
+ $table->columns_get()[5], |
|
80 | 88 |
], |
81 | 89 |
"columns_data" => |
82 | 90 |
[ |
... | ... |
@@ -88,9 +96,18 @@ function convert_genus($genus) {return [0 => "common", 1 => "masculine", 2 => "f |
88 | 96 |
return $values; |
89 | 97 |
}, |
90 | 98 |
"data_formatter" => function ($value) |
99 |
+ { |
|
100 |
+ switch (-1) |
|
101 |
+ { |
|
102 |
+ case 0: |
|
103 |
+ { |
|
104 |
+ return _baz($value[0]["words"], "word", "fs"); |
|
105 |
+ // break; |
|
106 |
+ } |
|
107 |
+ case 1: |
|
91 | 108 |
{ |
92 | 109 |
return ( |
93 |
- _bar("words") |
|
110 |
+ _bar("word") |
|
94 | 111 |
( |
95 | 112 |
[ |
96 | 113 |
"original" => $value[0]["words"], |
... | ... |
@@ -98,7 +115,14 @@ function convert_genus($genus) {return [0 => "common", 1 => "masculine", 2 => "f |
98 | 115 |
] |
99 | 116 |
) |
100 | 117 |
); |
118 |
+ // break; |
|
119 |
+ } |
|
120 |
+ default: |
|
121 |
+ { |
|
101 | 122 |
return json_encode($value); |
123 |
+ // break; |
|
124 |
+ } |
|
125 |
+ } |
|
102 | 126 |
}, |
103 | 127 |
] |
104 | 128 |
); |
... | ... |
@@ -19,10 +19,7 @@ |
19 | 19 |
new class_column |
20 | 20 |
( |
21 | 21 |
"IPA-sound", |
22 |
- function ($row) |
|
23 |
- { |
|
24 |
- return $row["ipa"]; |
|
25 |
- }, |
|
22 |
+ "ipa", |
|
26 | 23 |
function ($value) |
27 | 24 |
{ |
28 | 25 |
return format($value); |
... | ... |
@@ -32,19 +29,14 @@ |
32 | 29 |
new class_column |
33 | 30 |
( |
34 | 31 |
"Type", |
35 |
- function ($row) |
|
36 |
- { |
|
37 |
- return $row["type"]; |
|
32 |
+ "type"]; |
|
38 | 33 |
} |
39 | 34 |
), |
40 | 35 |
*/ |
41 | 36 |
new class_column |
42 | 37 |
( |
43 | 38 |
"Latin letter Representation", |
44 |
- function ($row) |
|
45 |
- { |
|
46 |
- return $row["latin"]; |
|
47 |
- }, |
|
39 |
+ "latin", |
|
48 | 40 |
function ($value) |
49 | 41 |
{ |
50 | 42 |
return format($value, ["letter", "lang_fs"]); |
... | ... |
@@ -53,10 +45,7 @@ |
53 | 45 |
new class_column |
54 | 46 |
( |
55 | 47 |
"Runic Representation", |
56 |
- function ($row) |
|
57 |
- { |
|
58 |
- return $row["runic"]; |
|
59 |
- }, |
|
48 |
+ "runic", |
|
60 | 49 |
function ($value) |
61 | 50 |
{ |
62 | 51 |
return format($value, ["letter", "lang_fs", "runic"]); |
... | ... |
@@ -65,35 +54,26 @@ |
65 | 54 |
new class_column |
66 | 55 |
( |
67 | 56 |
$configuration["languagemap"]["fs"] . " Example", |
68 |
- function ($row) |
|
69 |
- { |
|
70 |
- return $row["examples"]["fs"]; |
|
71 |
- }, |
|
57 |
+ "examples", |
|
72 | 58 |
function ($value) |
73 | 59 |
{ |
74 |
- return format($value, ["word", "lang_fs"]); |
|
60 |
+ return format($value["fs"], ["word", "lang_fs"]); |
|
75 | 61 |
} |
76 | 62 |
), |
77 | 63 |
new class_column |
78 | 64 |
( |
79 | 65 |
$configuration["languagemap"][$configuration["target"]] . " Example", |
80 |
- function ($row) use (&$configuration) |
|
81 |
- { |
|
82 |
- return $row["examples"][$configuration["target"]]; |
|
83 |
- }, |
|
66 |
+ "examples", |
|
84 | 67 |
function ($value) use (&$configuration) |
85 | 68 |
{ |
86 |
- return format($value, ["word", "lang_" . $configuration["target"]]); |
|
69 |
+ return format($value[$configuration["target"]], ["word", "lang_" . $configuration["target"]]); |
|
87 | 70 |
} |
88 | 71 |
), |
89 | 72 |
/* |
90 | 73 |
new class_column |
91 | 74 |
( |
92 | 75 |
"Remark", |
93 |
- function ($row) |
|
94 |
- { |
|
95 |
- return $row["remark"]; |
|
96 |
- }, |
|
76 |
+ "remark", |
|
97 | 77 |
function ($value) |
98 | 78 |
{ |
99 | 79 |
return format($value); |
... | ... |
@@ -9,10 +9,7 @@ |
9 | 9 |
new class_column |
10 | 10 |
( |
11 | 11 |
"Name", |
12 |
- function ($row) |
|
13 |
- { |
|
14 |
- return ["name" => $row["name"], "remark" => $row["remark"]]; |
|
15 |
- }, |
|
12 |
+ "name_", |
|
16 | 13 |
function ($value) |
17 | 14 |
{ |
18 | 15 |
$output = $value["name"]; |
... | ... |
@@ -26,18 +23,12 @@ |
26 | 23 |
new class_column |
27 | 24 |
( |
28 | 25 |
"Description", |
29 |
- function ($row) |
|
30 |
- { |
|
31 |
- return $row["description"]; |
|
32 |
- } |
|
26 |
+ "description" |
|
33 | 27 |
), |
34 | 28 |
new class_column |
35 | 29 |
( |
36 | 30 |
"Scheme", |
37 |
- function ($row) |
|
38 |
- { |
|
39 |
- return $row["scheme"]; |
|
40 |
- }, |
|
31 |
+ "scheme", |
|
41 | 32 |
function ($value) |
42 | 33 |
{ |
43 | 34 |
return format($value, ["word", "lang_fs"]); |
... | ... |
@@ -46,15 +37,20 @@ |
46 | 37 |
new class_column |
47 | 38 |
( |
48 | 39 |
"Example", |
49 |
- function ($row) |
|
50 |
- { |
|
51 |
- global $configuration; |
|
52 |
- return ["original" => [$row["example"]["original"]], "translated" => $row["example"]["translations"][$configuration["target"]]]; |
|
53 |
- }, |
|
40 |
+ "example_", |
|
54 | 41 |
_bar("sentence") |
55 | 42 |
), |
56 | 43 |
], |
57 |
- array_slice(read_json("source/data/timeforms.json"), 0, 3) |
|
44 |
+ sql_condense |
|
45 |
+ ( |
|
46 |
+ array_slice(read_json("source/data/timeforms.json"), 0, 3), |
|
47 |
+ ["name","remark","example"], |
|
48 |
+ ["name_","example_"], |
|
49 |
+ [ |
|
50 |
+ "name_" => function ($row) {return ["name" => $row["name"], "remark" => $row["remark"]];}, |
|
51 |
+ "example_" => function ($row) {global $configuration; return ["original" => [$row["example"]["original"]], "translated" => $row["example"]["translations"][$configuration["target"]]];}, |
|
52 |
+ ] |
|
53 |
+ ) |
|
58 | 54 |
))->generate(); |
59 | 55 |
?> |
60 | 56 |
<p>Since these forms are built with auxiliary verbs, they can be combined straightforward to form complex expressions, e.g. <?php echo(call_user_func(_bar("sentence"), ["original" => ["Ek skal have skrivt."], "translated" => ["I will have written."]])); ?><!-- or <?php echo(call_user_func(_bar("sentence"), ["original" => ["Ek hav skalt skrive."], "translated" => ["I was going to write."]])); ?> -->.</p> |
... | ... |
@@ -14,10 +14,7 @@ |
14 | 14 |
new class_column |
15 | 15 |
( |
16 | 16 |
"Affix", |
17 |
- function ($row) |
|
18 |
- { |
|
19 |
- return $row["affix"]; |
|
20 |
- }, |
|
17 |
+ "affix", |
|
21 | 18 |
function ($value) |
22 | 19 |
{ |
23 | 20 |
return mark($value, ["word", "lang_fs"]); |
... | ... |
@@ -26,10 +23,7 @@ |
26 | 23 |
new class_column |
27 | 24 |
( |
28 | 25 |
"Type", |
29 |
- function ($row) |
|
30 |
- { |
|
31 |
- return [$row["type_from"], $row["type_to"]]; |
|
32 |
- }, |
|
26 |
+ "type_", |
|
33 | 27 |
function ($value) |
34 | 28 |
{ |
35 | 29 |
return ( |
... | ... |
@@ -51,10 +45,7 @@ |
51 | 45 |
new class_column |
52 | 46 |
( |
53 | 47 |
"Description", |
54 |
- function ($row) |
|
55 |
- { |
|
56 |
- return ["name" => $row["name"], "description" => $row["description"]]; |
|
57 |
- }, |
|
48 |
+ "description_", |
|
58 | 49 |
function ($value) |
59 | 50 |
{ |
60 | 51 |
$output = ""; |
... | ... |
@@ -67,10 +58,7 @@ |
67 | 58 |
new class_column |
68 | 59 |
( |
69 | 60 |
"Cognates", |
70 |
- function ($row) |
|
71 |
- { |
|
72 |
- return $row["cognates"]; |
|
73 |
- }, |
|
61 |
+ "cognates", |
|
74 | 62 |
function ($value) |
75 | 63 |
{ |
76 | 64 |
return implode(", ", array_map(function ($entry) {return ($entry["language"] . ": " . mark($entry["affix"], ["word", "lang_" . $entry["language"]]));}, $value)); |
... | ... |
@@ -80,15 +68,21 @@ |
80 | 68 |
new class_column |
81 | 69 |
( |
82 | 70 |
"Example", |
83 |
- function ($row) |
|
84 |
- { |
|
85 |
- global $configuration; |
|
86 |
- return ["original" => [$row["example"]["word"]], "translated" => $row["example"]["translations"][$configuration["target"]]]; |
|
87 |
- }, |
|
71 |
+ "example_", |
|
88 | 72 |
_bar("word") |
89 | 73 |
), |
90 | 74 |
], |
91 |
- read_json("source/data/word_functions.json") |
|
75 |
+ sql_condense |
|
76 |
+ ( |
|
77 |
+ read_json("source/data/word_functions.json"), |
|
78 |
+ ["type_from","type_to","name","description","example"], |
|
79 |
+ ["type_","description_","example_"], |
|
80 |
+ [ |
|
81 |
+ "type_" => function ($values) {return [$values["type_from"], $values["type_to"]];}, |
|
82 |
+ "description_" => function ($values) {return ["name" => $values["name"], "description" => $values["description"]];}, |
|
83 |
+ "example_" => function ($values) {global $configuration; return ["original" => [$values["example"]["word"]], "translated" => $values["example"]["translations"][$configuration["target"]]];}, |
|
84 |
+ ] |
|
85 |
+ ) |
|
92 | 86 |
); |
93 | 87 |
$table->generate(); |
94 | 88 |
?> |
95 | 89 |