This is a simple engine for language-indepdent document (LID, based on ideas on definitionary.com).
Project description
Syntrans
This toolkit is based on the idea of Default Interlingual Synsets
You can write a hierarchy or graph in a YAML file, using precise concept meaning references from various namespaces of semantic web, notably, WikiData, automatically them converted into their representations in a language of choice.
The aim is to continue with introducing default meanings for tokens in languages, so as to convert not to arbitrary first expressions, but to the default expressions for concepts in each language. Since, those default expressions are likely to coincide with the multi-meaning traditional expressions, we want to come up with a way to emphasize default meanings in such texts, perhaps prepending words with a symbol like in the examples/test.yml, though, language references would also be required.
Usage
Install it with pip install synsets, then you can translate YAML documents with keys like in the examples directory, for example, using WikiData concept IDs with namespace WD: or other namespaces supported by Metawiki package.
syntrans -h usage: syntrans [-h] [-c CONCEPT] [-s SOURCE] [-l LANGUAGE] [-r REFRESH] optional arguments: -h, --help show this help message and exit -s SOURCE, --source SOURCE Source text file to parse. -l LANGUAGE, --language LANGUAGE Language reference, e.g., en, lt, ja, ru, cn. -r CONCEPT, --concept CONCEPT Single concept to refresh cache from source.
For example, let’s translate the sample text.
Example source:
$ cat examples/sample.yml WD:Q4503831: - WD:Q1156970 WD:Q7949 WD:Q8 WD:Q245962 - WD:Q1378301 WD:Q3 WD:Q15290 WD:Q185957 WD:Q468777 WD:Q245962
Example to English:
$ syntrans -s examples/sample.yml -l en goal: - humanity • truth • happiness • implementation - universal set • life • good • quality • existence • implementation
Example to Japanese:
syntrans -s examples/sample.yml -l ja 目標: - 人類 • 真理 • 幸福 • 実装 - 普遍集合 • 生命 • 善 • 品質 • 存在 • 実装
Refresh concept from web:
syntrans -r WD:Q1156970
Delete .concept folder to refresh all cached concepts.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
File details
Details for the file syntrans-0.5.0.tar.gz
.
File metadata
- Download URL: syntrans-0.5.0.tar.gz
- Upload date:
- Size: 4.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: Python-urllib/3.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4bef1ab017e5ec0718ca0a4f09a8d6aaa479d686a462c2b42f8f61f30be7c6ba |
|
MD5 | 7b45d54efbf8320a45de35799e02db46 |
|
BLAKE2b-256 | 5cdff839082119c1402c20eb6770035638cbfa5834943e9856473d65cfbaca1e |