Skip to content

Commit

Permalink
Merge pull request #10 from neverRare/master
Browse files Browse the repository at this point in the history
0.2.0
  • Loading branch information
neverRare authored Jan 24, 2024
2 parents 49508ad + 3bdee9b commit b64ce2b
Show file tree
Hide file tree
Showing 21 changed files with 2,331 additions and 1,303 deletions.
34 changes: 34 additions & 0 deletions .github/workflows/deno.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
# separate terms of service, privacy policy, and support
# documentation.

# This workflow will install Deno then run `deno lint` and `deno test`.
# For more information see: https://github.com/denoland/setup-deno

name: Deno

on:
push:
branches: ["release"]
pull_request:
branches: ["release"]

permissions:
contents: read

jobs:
test:
runs-on: ubuntu-latest

steps:
- name: Setup repo
uses: actions/checkout@v3

- name: Setup Deno
uses: denoland/setup-deno@v1
with:
deno-version: v1.x

- name: Build
run: deno task build
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
main.js
17 changes: 9 additions & 8 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
{
"cSpell.customDictionaries": {
"ku-suli": {
"name": "ku-suli",
"path": "${workspaceRoot}/nimi-ku-suli.txt",
"description": "Ku Suli words of Toki Pona",
"addWords": true
}
"cSpell.customDictionaries": {
"ku-suli": {
"name": "ku-suli",
"path": "${workspaceRoot}/nimi-ku-suli.txt",
"description": "Ku Suli words of Toki Pona",
"addWords": true
}
}
},
"deno.enable": true
}
31 changes: 28 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,35 @@
# Changelog

## 0.2.0

For this version. The whole code has been rewritten. The translator can now translate few more things! Although it's still not capable of translating full sentences.

- Implement translator for:
- Extended numbering system
- Reduplication
- _nanpa_ particle
- _en_ and _anu_
- Add button for translating, replacing auto-translate when typing.
- (Downgrade) Drop support for "a" particle.
- (Downgrade) Error messages are now very unreliable.
- (Downgrade) Translator is somewhat slower.
- Remove Discord DM as contact option.
- Update translation list:
- _tonsi_ – change nouns "transgender", "transgenders", "non-binary", and "non-binaries" into "transgender person", "transgender people", "non-binary person", and "non-binary people" (I DIDN'T MEAN TO OBJECTIFY THEM OMFG I'M SO SORRY 😭😭😭)

Inside update (intended for developers):

- Rewritten whole code to use TypeScript, module, and functional programming.
- Rewritten parser to use parser combinator.
- Add language codes to html.
- New wiki for contributors and thinkerers.
- Overhaul `README.md`, only including build instruction. Information about the translator is now moved to wiki.

## 0.1.1

- Update copyright notice
- Update version number on the page
- Update contacts to discord (from `neverRare#1517` to `never_rare`)
- Update copyright notice.
- Update version number on the page.
- Update contacts to Discord. (from `neverRare#1517` to `never_rare`)

## 0.1.0

Expand Down
7 changes: 7 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Contributing

You can do the usual github stuff: Open issue if there's an issue or you have a suggestion; Open pull request if you want to propose changes. If you want to propose a large change however, please open an issue first (or comment on an already existing issue page), and wait for my signal before beginning to work.

## The wiki

The wiki provides useful information for contributors, although it's not complete yet. Check it out: [Visit wiki](https://github.com/neverRare/toki-pona-translator/wiki).
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2022 neverRare
Copyright (c) 2024 neverRare

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
67 changes: 9 additions & 58 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,65 +4,16 @@ An imperfect Toki Pona to English translator that translates into multiple sente

[Try it](https://neverrare.github.io/toki-pona-translator/)

## Goals
## Building

The goals for this projects are:
You'll need [Deno](https://deno.com/). Run the following command.

- Provide translation that covers most of semantics and meaning of a Toki Pona sentence, but it doesn't have to be complete. This gives translations for users to scan into to give them a feel of how broad a Toki Pona sentence can mean.
- As much as possible, provide translations that are grammatically sound: not just correct but also feels right. For example, "red one thing" sounds off than "one red thing". Due to the difference of English and Toki Pona and nuances of English, the translator may fall severely short for this goal, but we can try!
```
git clone https://github.com/neverRare/toki-pona-translator.git
cd toki-pona-translator
deno task build
```

## Non-goals
Then open `./index.html` using your favorite browser.

- Provide every possible translations.
- Handle every edge cases of Toki Pona grammar. Some edge cases are listed in [limitations] along with others.
- Handle compounds such as translating "tomo tawa" into "vehicle"
- Translate Tokiponized proper word into what it was before such as translating "Manka" into "Minecraft"

Some of these may be lifted in the future.

## Terminology

These are the terminology used in [limitations]

- Headword – A single part of speech that in English, can be a noun, a verb, or an adjective; what the phrase starts with.
- Modifier – A part of speech that modifies headword or another modifier.
- Phrase – Headword and its modifiers.
- Clause – A part of sentence without "la" particle, "taso" particle in the beginning, "a" particles in the beginning and the end; found before and after "la", or the sentence itself without particles around it if it doesn't have "la".
- Proper Word – Proper name; Capitalized in Toki Pona.

## Limitations

[limitations]: #limitations

The following are currently unrecognized (non-definitive but pedantic).

- Full sentences: It can only translate phrases for now. The following limitations pretends the translator can translate full sentences, this is because these are planned limitations.
- Non-pu vocabulary with exception to "pu" ("tonsi" is included in the vocabulary)
- Multiple sentences
- Comma as sentence separator (commas are treated as decoration and ignored)
- Proper word as headword
- Having multiple consecutive "a"s inside a sentence (in the beginning or end is fine)
- "taso" as headword ("taso" is currently recognized as modifier or particle at the beginning of a sentence)
- Having no clause before or after "la" particle
- "mi/sina li (pred)" constructions
- "mi/sina (pred) li (pred)" constructions (this would be recognized as "mi (modifier) li (pred)")
- "mi/sina a (pred)" constructions
- Clause with both "li" and "o"
- Clause with multiple "o"s
- Clause with "en" but without predicate ("li" or "o")
- "nanpa" as ordinal particle
- Extended numbering system
- "kepeken" as headword or modifier
- Multiple "pi" on a phrase
- "pi" followed by at most one modifier
- Multiple separate proper word on a single phrase, unless they're separated by "pi" (Proper words spanning multiple words like "musi Manka Sawa" is fine, this limitation refers to something like "musi Manka pona Sawa"; something like "musi Manka pi kule Sawa" is fine)
- proper word followed by "pi"
- "anu" particle
- "la a"
- "en a"
- "li a"
- "o a"
- "e a"
- "pi a"

Some of these may be lifted in the future.
Whenever you made changes to `./src/*.ts`, you'll need to run `deno task build` again and refresh the browser. Later I'll make a script to automate this.
10 changes: 10 additions & 0 deletions bundle.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import { bundle } from "https://deno.land/x/[email protected]/mod.ts";

const SOURCE = "./src/main.ts";
const DESTINATION = "./main.js";

const url = new URL(SOURCE, import.meta.url);
const result = await bundle(url);

const { code } = result;
await Deno.writeTextFile(DESTINATION, code);
16 changes: 16 additions & 0 deletions deno.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"lock": false,
"compilerOptions": {
"target": "esnext",
"lib": ["dom", "dom.iterable", "dom.asynciterable", "deno.ns"]
},
"tasks": {
"build": "deno run --allow-read --allow-write --allow-env ./bundle.ts"
},
"fmt": {
"include": ["./src/**/*.ts", "./bundle.ts", "./test-parser.ts"]
},
"lint": {
"include": ["./src/**/*.ts", "./bundle.ts", "./test-parser.ts"]
}
}
15 changes: 9 additions & 6 deletions index.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<!DOCTYPE html>
<html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="author" content="neverRare" />
Expand All @@ -24,11 +24,15 @@ <h1>Toki Pona Translator</h1>
<p>
An imperfect Toki Pona to English translator that translates into multiple
sentences.
<a href="https://github.com/neverRare/toki-pona-translator#limitations"
<a
href="https://github.com/neverRare/toki-pona-translator/wiki/Limitations"
>Limitations</a
>.
</p>
<textarea id="input" placeholder="o toki tawa ni"></textarea>
<textarea id="input" placeholder="o toki tawa ni" lang="tok"></textarea>
<div>
<button id="translate-button">Translate</button>
</div>
<ul id="output"></ul>
<p id="error"></p>
<details>
Expand All @@ -51,7 +55,6 @@ <h1>Toki Pona Translator</h1>
>Toki Pona to multiple English sentence translator</a
>.
</li>
<li>Dm me on Discord: never_rare</li>
<li>
Email me:
<a href="mailto:[email protected]"
Expand All @@ -63,8 +66,8 @@ <h1>Toki Pona Translator</h1>
<footer>
<p>
<a
href="https://github.com/neverRare/toki-pona-translator/blob/master/CHANGELOG.md#002"
>v0.1.1</a
href="https://github.com/neverRare/toki-pona-translator/blob/master/CHANGELOG.md"
>v0.2.0</a
>
- &copy; 2024 neverRare -
<a
Expand Down
Loading

0 comments on commit b64ce2b

Please sign in to comment.