Lingua-Poly is a system for disassembling natural languages.
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
e2e
perl
po
src
.editorconfig
.gitignore
LICENSE
README.asciidoc
TODO.md
angular.json
package.json
proxy.conf.json.sample
schema.sql
tsconfig.json
tslint.json
yarn.lock

README.asciidoc

Lingua-Poly

1. Status

Pre-alpha, incomplete.

The first language being implemented is Finnish. Currently, the present tense indicative active of Finnish verbs is being implemented.

2. Prerequisites

2.1. Node.js

Node.js is required in order to build or run the front-end.

2.2. Yarn

You will also need Yarn. The website has information on how to install it.

2.3. Perl

You need Perl in order to run the backend.

Install the required Perl modules with 'cpanm':

$ cd /path/to/Lingua-Poly
$ cd perl
$ sudo cpanm --installdeps .
$ sudo cpanm -n .

3. Getting Started

3.1. Backend

3.1.1. Database

You will need an instance of a PostgreSQL (version 9 or better) database up and running. Create a database 'linguapoly':

$ createdb linguapoly

This assumes that your PostgreSQL server is running on your local machine. Get more information with man createdb if that assumption is wrong or there is an error.

3.1.2. Populate Database

You can initialize the database like this:

$ psql linguapoly <schema.sql

Replace "linguapoly" with the name of the database created above. Run the command in the root directory of this project.

3.1.3. Configuration

You need a minimal configuration file api.conf.yaml in YAML format in the current directory:

database:
    dbname: linguapoly
    user: nobody
    pass: mysecretpassword
session:
    timeout: 600
prefix: /api/v1

Make sure that the configured database user has sufficient privileges to read and write all tables in the database.

3.1.4. Starting the Backend Server

Start the backend server like this:

$ cd /path/to/Lingua-Poly/perl
$ PERL5LIB=lib plackup lingua-poly.psgi

Other environment variables than 'PERL5LIB':

LINGUA_POLY_DEBUG

A list of debugging realms separated by commas, spaces, tabs, colons, or pipe symbols. The following realms are currently supported:

core

the core API framework

session

session handling and controller methods

db

database-related stuff

request

set a debugger breakpoint at the beginning of the request handler

all

all of the above

3.1.5. Manually Create Passwords

You can manually create a password (digest) with this one-liner:

$ perl -MDigest::SHA -le 'print "{SHA512}" . Digest::SHA::sha512_hex("admin") . "="'
{SHA512}c7ad44cbad762a5da0a452f9e854fdc1e0e7a52a38015f23f3eab1d80b931dd472634dfac71cd34ebc35d16ab7fb8a90c81f975113d6c7538dc69dd8de9077ec=

Replace "admin" with a cleartext password.

You can assign this password to user@example.com like this:

$ echo "UPDATE users SET password = '{SHA512}c7ad44cbad762a5da0a452f9e854fdc1e0e7a52a38015f23f3eab1d80b931dd472634dfac71cd34ebc35d16ab7fb8a90c81f975113d6c7538dc69dd8de9077ec=' WHERE email = 'user@example.com'

Replace "user@example.com" with the user’s login, and the part beginning with {SHA512} with the output of the above one-liner.

4. Frontend

4.1. Static Distribution

Build the frontend like this:

$ cd /path/to/Lingua-Poly
$ yarn run build
yarn run v1.3.2
$ ng build
                                                                              u Date: 2018-09-15T08:18:32.873Z
Hash: ad5d2f974c866b850a32
Time: 5189ms
chunk {main} main.js, main.js.map (main) 9.38 kB [initial] [rendered]
chunk {polyfills} polyfills.js, polyfills.js.map (polyfills) 227 kB [initial] [rendered]
chunk {runtime} runtime.js, runtime.js.map (runtime) 5.22 kB [entry] [rendered]
chunk {styles} styles.js, styles.js.map (styles) 15.6 kB [initial] [rendered]
chunk {vendor} vendor.js, vendor.js.map (vendor) 2.94 MB [initial] [rendered]
✨  Done in 9.21s.

This will create a directory named 'dist/Lingua-Poly' with all frontend files. Move the contents of this directory into the document root of your web server or …​

4.2. Run Development Version

Alternatively you can run the application with a built-in web server:

$ cd /path/to/Poly-Lingua
$ yarn start
yarn run v1.3.2
$ ng serve --open
** Angular Live Development Server is listening on localhost:4200, open your browser on http://localhost:4200/ **
...

The application is then available at http://localhost:4200/.

You have to tell the development web server the URI of the backend API server. Copy the file 'proxy.conf.json.sample' to 'proxy.conf.json' and edit it to your needs.

Copyright © 2018 Guido Flohr guido.flohr@cantanea.com, all rights reserved.

This library is free software. It comes without any warranty, to the extent permitted by applicable law. You can redistribute it and/or modify it under the terms of the Do What the Fuck You Want to Public License, Version 2, as published by Sam Hocevar. See http://www.wtfpl.net/ for more details.