Initial commit

main
Kevin López 2021-01-13 00:18:19 -03:00
commit a2e1595b89
16 changed files with 8771 additions and 0 deletions

13
.editorconfig Normal file
View File

@ -0,0 +1,13 @@
# editorconfig.org
root = true
[*]
indent_style = space
indent_size = 2
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true
[*.md]
trim_trailing_whitespace = false

17
.github/dependabot.yml vendored Normal file
View File

@ -0,0 +1,17 @@
version: 2
updates:
# Fetch and update latest `npm` packages
- package-ecosystem: npm
directory: '/'
schedule:
interval: daily
time: '00:00'
open-pull-requests-limit: 10
reviewers:
- kddlb
assignees:
- kddlb
commit-message:
prefix: fix
prefix-development: chore
include: scope

90
.gitignore vendored Normal file
View File

@ -0,0 +1,90 @@
# Created by .ignore support plugin (hsz.mobi)
### Node template
# Logs
/logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
# Runtime data
pids
*.pid
*.seed
*.pid.lock
# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov
# Coverage directory used by tools like istanbul
coverage
# nyc test coverage
.nyc_output
# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
.grunt
# Bower dependency directory (https://bower.io/)
bower_components
# node-waf configuration
.lock-wscript
# Compiled binary addons (https://nodejs.org/api/addons.html)
build/Release
# Dependency directories
node_modules/
jspm_packages/
# TypeScript v1 declaration files
typings/
# Optional npm cache directory
.npm
# Optional eslint cache
.eslintcache
# Optional REPL history
.node_repl_history
# Output of 'npm pack'
*.tgz
# Yarn Integrity file
.yarn-integrity
# dotenv environment variables file
.env
# parcel-bundler cache (https://parceljs.org/)
.cache
# next.js build output
.next
# nuxt.js build output
.nuxt
# Nuxt generate
dist
# vuepress build output
.vuepress/dist
# Serverless directories
.serverless
# IDE / Editor
.idea
# Service worker
sw.*
# macOS
.DS_Store
# Vim swap files
*.swp

21
LICENSE Normal file
View File

@ -0,0 +1,21 @@
MIT License
Copyright (c) 2021 Kevin López Brante
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

20
README.md Normal file
View File

@ -0,0 +1,20 @@
# IPAServer
## Build Setup
```bash
# install dependencies
$ yarn install
# serve with hot reload at localhost:3000
$ yarn dev
# build for production and launch server
$ yarn build
$ yarn start
# generate static project
$ yarn generate
```
For detailed explanation on how things work, check out [Nuxt.js docs](https://nuxtjs.org).

25
api/espeak.js Normal file
View File

@ -0,0 +1,25 @@
const bodyParser = require('body-parser')
const app = require('express')()
const fs = require('fs')
const tmp = require('tmp')
const exec = require('child_process').exec;
const eSpeakExecutable = process.platform === "win32" ? `"C:\\Program Files\\eSpeak NG\\espeak-ng.exe"` : `/usr/bin/espeak-ng`
app.use(bodyParser.json())
app.post('/get', (req, res, next) => {
tmp.file(function _tempFileCreated(err, path, fd, cleanupCallback) {
if (err) throw err;
fs.writeFile(path, req.body.sourceText, {encoding: "utf-8"}, ()=> {
exec(`${eSpeakExecutable} -v"${req.body.selectedLanguage}" -q -f "${path}" --ipa"`, ((error, stdout, stderr) => {
res.json({out: stdout.trim(), stderr})
}))
})
cleanupCallback()
});
})
module.exports = app

12
jsconfig.json Normal file
View File

@ -0,0 +1,12 @@
{
"compilerOptions": {
"baseUrl": ".",
"paths": {
"~/*": ["./*"],
"@/*": ["./*"],
"~~/*": ["./*"],
"@@/*": ["./*"]
}
},
"exclude": ["node_modules", ".nuxt", "dist"]
}

7
layouts/README.md Normal file
View File

@ -0,0 +1,7 @@
# LAYOUTS
**This directory is not required, you can delete it if you don't want to use it.**
This directory contains your Application Layouts.
More information about the usage of this directory in [the documentation](https://nuxtjs.org/guide/views#layouts).

11
layouts/default.vue Normal file
View File

@ -0,0 +1,11 @@
<template>
<div>
<Nuxt />
<footer class="footer mt-auto py-3 bg-light">
<b-container fluid>
<span class="text-muted">Powered by <a href="https://github.com/espeak-ng/espeak-ng" target="_blank">eSpeak-NG</a> and <a href="https://nuxtjs.org" target="_blank">Nuxt.js</a>.</span>
</b-container>
</footer>
</div>
</template>

54
nuxt.config.js Normal file
View File

@ -0,0 +1,54 @@
export default {
// Global page headers (https://go.nuxtjs.dev/config-head)
head: {
title: 'IPAServer',
meta: [
{ charset: 'utf-8' },
{ name: 'viewport', content: 'width=device-width, initial-scale=1' },
{ hid: 'description', name: 'description', content: '' }
],
link: [
{ rel: 'icon', type: 'image/x-icon', href: '/favicon.ico' }
]
},
// Global CSS (https://go.nuxtjs.dev/config-css)
css: [
],
// Plugins to run before rendering page (https://go.nuxtjs.dev/config-plugins)
plugins: [
],
// Auto import components (https://go.nuxtjs.dev/config-components)
components: true,
// Modules for dev and build (recommended) (https://go.nuxtjs.dev/config-modules)
buildModules: [
],
// Modules (https://go.nuxtjs.dev/config-modules)
modules: [
// https://go.nuxtjs.dev/bootstrap
'bootstrap-vue/nuxt',
// https://go.nuxtjs.dev/axios
'@nuxtjs/axios',
],
// Axios module configuration (https://go.nuxtjs.dev/config-axios)
axios: {},
serverMiddleware: [
{ path: "/api", handler: "~/api/espeak.js" },
],
loading: {
color: '#078f32',
height: '15px'
},
// Build Configuration (https://go.nuxtjs.dev/config-build)
build: {
}
}

24
package.json Normal file
View File

@ -0,0 +1,24 @@
{
"name": "IPAServer",
"version": "1.0.0",
"private": true,
"scripts": {
"dev": "nuxt",
"build": "nuxt build",
"start": "nuxt start",
"generate": "nuxt generate"
},
"dependencies": {
"@nuxtjs/axios": "^5.12.2",
"body-parser": "^1.19.0",
"bootstrap": "^4.5.2",
"bootstrap-vue": "^2.17.3",
"core-js": "^3.6.5",
"express": "^4.17.1",
"nuxt": "^2.14.6",
"tmp": "^0.2.1"
},
"devDependencies": {
"@nuxt/types": "~2.14.0"
}
}

6
pages/README.md Normal file
View File

@ -0,0 +1,6 @@
# PAGES
This directory contains your Application Views and Routes.
The framework reads all the `*.vue` files inside this directory and creates the router of your application.
More information about the usage of this directory in [the documentation](https://nuxtjs.org/guide/routing).

425
pages/index.vue Normal file
View File

@ -0,0 +1,425 @@
<template>
<b-container fluid class="py-3">
<h1>IPA Server</h1>
<b-row>
<b-col cols="12" md="6">
<h2>Source text</h2>
<b-form-textarea
id="textarea"
v-model="sourceText"
debounce="99"
placeholder="Enter your text here"
rows="12"
max-rows="25"
/>
<b-form-select class="mt-2" v-model="selectedLanguage" :options="languages"></b-form-select>
</b-col>
<b-col cols="12" md="6">
<h2>IPA output</h2>
<b-card>
<pre class="text-wrap">{{targetText.out}}</pre>
</b-card>
</b-col>
</b-row>
</b-container>
</template>
<script>
export default {
data() {
return {
sourceText: "",
targetText: "",
selectedLanguage: "en-us",
languages: [
{
"value": "af",
"text": "Afrikaans"
},
{
"value": "am",
"text": "Amharic"
},
{
"value": "an",
"text": "Aragonese"
},
{
"value": "as",
"text": "Assamese"
},
{
"value": "az",
"text": "Azerbaijani"
},
{
"value": "bg",
"text": "Bulgarian"
},
{
"value": "bn",
"text": "Bengali"
},
{
"value": "bs",
"text": "Bosnian"
},
{
"value": "ca",
"text": "Catalan"
},
{
"value": "cmn",
"text": "Chinese (Mandarin)"
},
{
"value": "cs",
"text": "Czech"
},
{
"value": "cy",
"text": "Welsh"
},
{
"value": "da",
"text": "Danish"
},
{
"value": "de",
"text": "German"
},
{
"value": "el",
"text": "Greek"
},
{
"value": "en-029",
"text": "English (Caribbean)"
},
{
"value": "en-gb",
"text": "English (Great Britain)"
},
{
"value": "en-gb-scotland",
"text": "English (Scotland)"
},
{
"value": "en-gb-x-gbclan",
"text": "English (Lancaster)"
},
{
"value": "en-gb-x-gbcwmd",
"text": "English (West Midlands)"
},
{
"value": "en-gb-x-rp",
"text": "English (Received Pronunciation)"
},
{
"value": "en-us",
"text": "English (United States)"
},
{
"value": "eo",
"text": "Esperanto"
},
{
"value": "es",
"text": "Spanish (Spain)"
},
{
"value": "es-419",
"text": "Spanish (Latin America)"
},
{
"value": "et",
"text": "Estonian"
},
{
"value": "eu",
"text": "Basque"
},
{
"value": "fa",
"text": "Persian"
},
{
"value": "fa-latn",
"text": "Persian (Pinglish)"
},
{
"value": "fi",
"text": "Finnish"
},
{
"value": "fr-be",
"text": "French (Belgium)"
},
{
"value": "fr-fr",
"text": "French (France)"
},
{
"value": "ga",
"text": "Gaelic (Irish)"
},
{
"value": "gd",
"text": "Gaelic (Scottish)"
},
{
"value": "gn",
"text": "Guarani"
},
{
"value": "grc",
"text": "Greek (Ancient)"
},
{
"value": "gu",
"text": "Gujarati"
},
{
"value": "hi",
"text": "Hindi"
},
{
"value": "hr",
"text": "Croatian"
},
{
"value": "hu",
"text": "Hungarian"
},
{
"value": "hy",
"text": "Armenian (East Armenia)"
},
{
"value": "hyw",
"text": "Armenian (West Armenia)"
},
{
"value": "ia",
"text": "Interlingua"
},
{
"value": "id",
"text": "Indonesian"
},
{
"value": "is",
"text": "Icelandic"
},
{
"value": "it",
"text": "Italian"
},
{
"value": "jbo",
"text": "Lojban"
},
{
"value": "ka",
"text": "Georgian"
},
{
"value": "kl",
"text": "Greenlandic"
},
{
"value": "kn",
"text": "Kannada"
},
{
"value": "ko",
"text": "Korean"
},
{
"value": "ku",
"text": "Kurdish"
},
{
"value": "ky",
"text": "Kyrgyz"
},
{
"value": "la",
"text": "Latin"
},
{
"value": "lfn",
"text": "Lingua Franca Nova"
},
{
"value": "lt",
"text": "Lithuanian"
},
{
"value": "lv",
"text": "Latvian"
},
{
"value": "mk",
"text": "Macedonian"
},
{
"value": "ml",
"text": "Malayalam"
},
{
"value": "mr",
"text": "Marathi"
},
{
"value": "ms",
"text": "Malay"
},
{
"value": "mt",
"text": "Maltese"
},
{
"value": "my",
"text": "Myanmar (Burmese)"
},
{
"value": "nb",
"text": "Norwegian Bokmål"
},
{
"value": "nci",
"text": "Nahuatl (Classical)"
},
{
"value": "ne",
"text": "Nepali"
},
{
"value": "nl",
"text": "Dutch"
},
{
"value": "om",
"text": "Oromo"
},
{
"value": "or",
"text": "Oriya"
},
{
"value": "pa",
"text": "Punjabi"
},
{
"value": "pap",
"text": "Papiamento"
},
{
"value": "pl",
"text": "Polish"
},
{
"value": "pt",
"text": "Portuguese (Portugal)"
},
{
"value": "pt-br",
"text": "Portuguese (Brazil)"
},
{
"value": "ro",
"text": "Romanian"
},
{
"value": "ru",
"text": "Russian"
},
{
"value": "si",
"text": "Sinhala"
},
{
"value": "sk",
"text": "Slovak"
},
{
"value": "sl",
"text": "Slovenian"
},
{
"value": "sq",
"text": "Albanian"
},
{
"value": "sr",
"text": "Serbian"
},
{
"value": "sv",
"text": "Swedish"
},
{
"value": "sw",
"text": "Swahili"
},
{
"value": "ta",
"text": "Tamil"
},
{
"value": "te",
"text": "Telugu"
},
{
"value": "tn",
"text": "Setswana"
},
{
"value": "tr",
"text": "Turkish"
},
{
"value": "tt",
"text": "Tatar"
},
{
"value": "ur",
"text": "Urdu"
},
{
"value": "vi",
"text": "Vietnamese (Northern)"
},
{
"value": "vi-vn-x-central",
"text": "Vietnamese (Central)"
},
{
"value": "vi-vn-x-south",
"text": "Vietnamese (Southern)"
},
{
"value": "yue",
"text": "Chinese (Cantonese)"
}
].sort((a,b)=>(a.text>b.text)?1:-1)
}
},
watch: {
async sourceText(newValue) {
this.targetText = await this.$axios.$post("/api/get", {
sourceText: newValue,
selectedLanguage: this.selectedLanguage
})
},
async selectedLanguage(newValue) {
this.targetText = await this.$axios.$post("/api/get", {
sourceText: this.sourceText,
selectedLanguage: newValue
})
}
}
}
</script>

11
static/README.md Normal file
View File

@ -0,0 +1,11 @@
# STATIC
**This directory is not required, you can delete it if you don't want to use it.**
This directory contains your static files.
Each file inside this directory is mapped to `/`.
Thus you'd want to delete this README.md before deploying to production.
Example: `/static/robots.txt` is mapped as `/robots.txt`.
More information about the usage of this directory in [the documentation](https://nuxtjs.org/guide/assets#static).

BIN
static/favicon.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

8035
yarn.lock Normal file

File diff suppressed because it is too large Load Diff