-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
117 lines (117 loc) · 3.74 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
<!DOCTYPE html>
<html lang="zh-TW">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>國語-臺語機械翻譯</title>
<meta name="author" content="三日月綾香" />
<meta name="keywords" content="臺灣閩南語, 台語, 人工智能, 翻譯, 翻譯器" />
<meta name="description" content="臺灣閩南語翻譯器,是使用人工智慧自動將文字從國語翻譯成臺語的系統。GET 要求 https://ayaka-apps.shn.hk/twblg-translate/?s=目標字串,回傳 JSON 格式的翻譯結果。本 Web API 基於國語-臺語機械翻譯,頁面原始碼公開於 GitHub。">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/build/forms-nr-min.css" />
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/build/buttons-min.css" />
<script>
function handleSubmit() {
document.getElementById('loading').classList.remove('hidden');
var payload = document.getElementById('inputArea').value;
fetch('https://ayaka-apps.shn.hk/twblg-translate/?' + new URLSearchParams({
s: payload,
}))
.then((response) => response.json())
.then((data) => {
document.getElementById('loading').classList.add('hidden');
document.getElementById('outputArea').innerText = data.join('\n');
})
.catch((error) => console.error('Error:', error));
}
window.addEventListener('DOMContentLoaded', function() {
var _h = 'shn.hk';
var _a = '@mail.';
var _n = 'ayaka';
var _e = _n + _a + _h;
_a = document.createElement('span');
_a.innerHTML = _e;
document.getElementById('gd').href = 'm' + 'a' + 'ilto' + ':' + _a.innerText;
});
</script>
<!-- CSS rules are mainly taken from http://jgrammar.life.coocan.jp/ja/index.htm -->
<style>
body {
background-color: #e0ffe0;
color: black;
font-family: sans-serif, sans-serif;
line-height: 1.6;
}
h1 {
background-color: aqua;
color: navy;
}
form {
background-color: #e0ffff;
color: inherit;
}
h2 {
background-color: navy;
color: white;
}
textarea {
display: block;
font-size: 150%;
}
output {
display: block;
font-size: x-large;
}
a:link {
background: inherit;
color: blue;
}
textarea {
max-width: calc(100vw - 1.25em);
}
.wrapper {
background: #ffffe0;
border: 1px solid black;
color: inherit;
}
.wrapper2 > * {
padding: 0 0.5rem;
}
.align-right {
text-align: right;
}
.hidden {
color: red;
display: none;
}
.pure-button {
padding: 0.3em 1em;
}
</style>
</head>
<body>
<h1>國語-臺語機械翻譯</h1>
<p class="align-right">作者:<a id="gd" href="mailto:[email protected]">三日月 綾香</a></p>
<hr/>
<div class="wrapper">
<form class="pure-form" onsubmit="handleSubmit(); return false">
<textarea class="form-control pure-input-1" id="inputArea" rows="5">明天不用上班,可以安心入睡。</textarea>
<p><input class="btn btn-primary pure-button" type="submit" value="翻譯" /> <span id="loading" class="hidden">載入中…</span></p>
</form>
<div class="wrapper2">
<h2>翻譯結果</h2>
<output id="outputArea">
明仔載免上班,會使穩心仔困。<br />
明仔載免上班,會使安心困。<br />
明仔載免上班,會使安心入眠。
</output>
<h2>Web API 参照</h2>
<p>GET 要求 <code>https://ayaka-apps.shn.hk/twblg-translate/?s=目標字串</code>,回傳 JSON 格式的翻譯結果。本 Web API 基於<a href="https://github.com/ayaka14732/bart-base-jax/tree/twblg">國語-臺語機械翻譯</a>,頁面原始碼公開於 <a href="https://github.com/ayaka14732/twblg-translate">GitHub</a>。</p>
</div>
</div>
<hr/>
<ul>
<li>2022/09/16 初版</li>
</ul>
<hr/>
</body>
</html>