├── server ├── data │ └── .gitignore ├── run.sh ├── package.json └── main.js ├── test ├── requirements.txt ├── test_checkout.py ├── test_commit.py └── test_flow.py ├── Dockerfile ├── sample.py ├── README.md ├── scripts └── calculate_length_ratios.py ├── filter.py ├── translate.py └── LICENSE /server/data/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | -------------------------------------------------------------------------------- /server/run.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | node --max-old-space-size=8192 main.js -p 5555 4 | -------------------------------------------------------------------------------- /test/requirements.txt: -------------------------------------------------------------------------------- 1 | certifi==2023.7.22 2 | charset-normalizer==3.2.0 3 | idna==3.4 4 | requests==2.31.0 5 | urllib3==2.0.4 6 | -------------------------------------------------------------------------------- /test/test_checkout.py: -------------------------------------------------------------------------------- 1 | import requests 2 | 3 | r = requests.get('http://localhost:4000/checkout?dataset=test-ds&lang=it&timeout=60', timeout=30) 4 | print(r.json()) 5 | -------------------------------------------------------------------------------- /test/test_commit.py: -------------------------------------------------------------------------------- 1 | import requests 2 | 3 | r = requests.post('http://localhost:4000/commit', json={ 4 | 'dataset': "piero", 'batchId': 0, 'phrases': ["abc", "cde", "123"], 'lang': "it" 5 | }, timeout=30) 6 | print(r.json()) 7 | -------------------------------------------------------------------------------- /server/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "nllu-server", 3 | "version": "1.0.0", 4 | "description": "", 5 | "main": "main.js", 6 | "scripts": { 7 | "test": "echo \"Error: no test specified\" && exit 1" 8 | }, 9 | "author": "", 10 | "license": "ISC", 11 | "dependencies": { 12 | "express": "^4.18.2", 13 | "minimist": "^1.2.8" 14 | }, 15 | "devDependencies": { 16 | "nodemon": "^3.0.1" 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /test/test_flow.py: -------------------------------------------------------------------------------- 1 | import requests 2 | 3 | url = "http://localhost:4000" 4 | dataset = "piero" 5 | lang = "fr" 6 | 7 | batch = {'done': False} 8 | while not batch['done']: 9 | r = requests.get(f'{url}/checkout?dataset={dataset}&lang={lang}&timeout=60', timeout=30) 10 | batch = r.json() 11 | if batch['done']: 12 | break 13 | 14 | print(batch) 15 | r = requests.post(f'{url}/commit', json={ 16 | 'dataset': dataset, 'batchId': batch['batchId'], 'phrases': [f"{p} - translated" for p in batch['phrases']], 'lang': lang 17 | }, timeout=30) 18 | print(r.json()) 19 | 20 | 21 | r = requests.get(f'{url}/download?dataset={dataset}&lang={lang}', timeout=30) 22 | print(r.content) 23 | -------------------------------------------------------------------------------- /Dockerfile: -------------------------------------------------------------------------------- 1 | FROM nvidia/cuda:11.2.2-runtime-ubuntu20.04 2 | ARG DEBIAN_FRONTEND=noninteractive 3 | 4 | RUN apt-get update && apt-get install -y python3 python3-pip wget unzip && \ 5 | pip install ctranslate2==3.18.0 requests==2.28.1 sentencepiece==0.1.99 && \ 6 | mkdir /app && \ 7 | cd /tmp && wget https://pretrained-nmt-models.s3.us-west-2.amazonaws.com/CTranslate2/nllb/nllb-200_3.3B_int8_ct2.zip && \ 8 | wget https://pretrained-nmt-models.s3.us-west-2.amazonaws.com/CTranslate2/nllb/flores200_sacrebleu_tokenizer_spm.model && \ 9 | unzip nllb-200_3.3B_int8_ct2.zip && \ 10 | mv /tmp/nllb-200-3.3B-int8 /app/model && \ 11 | mv /tmp/flores200_sacrebleu_tokenizer_spm.model /app/model/sp.model && \ 12 | rm /tmp/* 13 | 14 | ADD translate.py /app 15 | WORKDIR /app 16 | 17 | ENTRYPOINT ["/usr/bin/python3", "/app/translate.py"] -------------------------------------------------------------------------------- /sample.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | import argparse 3 | import random 4 | import os 5 | parser = argparse.ArgumentParser(description='Sample a subset of translations from a parallel corpus') 6 | parser.add_argument('source', 7 | type=str, 8 | default=None, 9 | help='Source input .txt file') 10 | parser.add_argument('target', 11 | type=str, 12 | default=None, 13 | help='Target input .txt file') 14 | parser.add_argument('samples', 15 | type=int, 16 | default=None, 17 | help='Number of samples') 18 | 19 | 20 | args = parser.parse_args() 21 | 22 | source_dst = args.source + ".sampled.%s" % args.samples 23 | target_dst = args.target + ".sampled.%s" % args.samples 24 | 25 | if os.path.isfile(source_dst): 26 | print("File exists: %s exiting..." % source_dst) 27 | exit(1) 28 | if os.path.isfile(target_dst): 29 | print("File exists: %s exiting..." % target_dst) 30 | exit(1) 31 | 32 | print("Reading %s" % args.source) 33 | source_lines = [] 34 | with open(args.source, "r", encoding="utf-8") as f: 35 | while True: 36 | line = f.readline().strip() 37 | if line == '': 38 | break 39 | source_lines.append(line) 40 | # source_lines = [l.strip() for l in f.read().split("\n")] 41 | 42 | print("Reading %s" % args.target) 43 | target_lines = [] 44 | with open(args.target, "r", encoding="utf-8") as f: 45 | while True: 46 | line = f.readline().strip() 47 | if line == '': 48 | break 49 | target_lines.append(line) 50 | #target_lines = [l.strip() for l in f.read().split("\n")] 51 | 52 | if len(source_lines) != len(target_lines): 53 | print("Files have different number of lines (%s vs. %s)" % (len(source_lines), len(target_lines))) 54 | exit(1) 55 | 56 | 57 | 58 | sampled = {} 59 | with open(source_dst, "w", encoding="utf-8") as fs: 60 | with open(target_dst, "w", encoding="utf-8") as ft: 61 | i = 0 62 | num_samples = min(len(source_lines), args.samples) 63 | while i < num_samples: 64 | r = random.randint(0, len(target_lines)) 65 | if not r in sampled: 66 | fs.write(source_lines[r] + "\n") 67 | ft.write(target_lines[r] + "\n") 68 | sampled[r] = True 69 | i += 1 70 | 71 | print("Wrote %s" % source_dst) 72 | print("Wrote %s" % target_dst) 73 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # No Language Left Unlocked 🔓 2 | 3 | In 2022 Meta released [NLLB](https://arxiv.org/pdf/2207.04672.pdf), a set of multi-lingual models for machine translation with impressive performance. But the model weights have been released using a restrictive non-commercial license, making them unusable for most open-source projects. The models also suffer by having a limited dictionary, which causes many translations to return unknown tokens. 4 | 5 | This repository contains the software to run NLLU, an effort to run NLLB inference at scale to generate a corpus of bitext data that can be used to train new, permissively licensed language models. 6 | 7 | Running NLLB inference on million of sentences is intensive and it would take years to perform on a single machine. We designed a simple server architecture which can distribute batches of sentences to be translated asynchronously across machines, which can be rented cheaply with providers such as [vast.ai](https://vast.ai) or [runpod.io](https://runpod.io). 8 | 9 | ## Datasets 10 | 11 | Available at: [nllu.libretranslate.com](https://nllu.libretranslate.com) 12 | 13 | We welcome requests/contributions for adding more datasets and languages! [Get in touch](https://community.libretranslate.com). 14 | 15 | ## Usage 16 | 17 | ### Server 18 | 19 | We use [NodeJS](https://nodejs.org) for the server. 20 | 21 | ```bash 22 | git clone https://github.com/LibreTranslate/nllu 23 | cd nllu/server 24 | npm i 25 | ``` 26 | 27 | * Create a new directory in `nllu/server/data/` 28 | * Place a monolingual English corpus in `nllu/server/data//source.txt` (one sentence per line) 29 | * Run: 30 | 31 | ```bash 32 | cd nllu/server 33 | node main.js -p 5555 --batch-size 100 34 | Listening on port 5555 35 | ``` 36 | 37 | The server has persistency built-in, so you can restart it without losing state information (just don't change batch-size between restarts). 38 | 39 | ### Client 40 | 41 | ```bash 42 | docker run -ti --rm --gpus=all libretranslate/nllu --server http://:5555 --dataset --target-lang --batch-size 4 --split 43 | ``` 44 | 45 | We recommend tweaking `batch-size` to increase the translation speed, although in our experience it's actually faster to set this value to `1`. `--split` will reduce memory usage on the GPU by loading only `batch-size` sentences at a time during translation. 46 | 47 | You should tweak the `--checkout-timeout` option, expressed in seconds, if you expect a client to process a batch in longer than 1 hour (the default). 48 | 49 | #### Rebuild Docker Image 50 | 51 | ```bash 52 | docker build -t youruser/nllu . 53 | ``` 54 | 55 | ### Download Results 56 | 57 | Once the entire dataset is translated, one can download it by visiting: 58 | 59 | `http:///download?dataset=&lang=` 60 | 61 | Or by issuing: 62 | 63 | ```bash 64 | cd nllu/server// 65 | cat *.txt > ../merged.txt 66 | ``` 67 | 68 | ### Filter Results 69 | 70 | We provide a script to filter the backtranslated data, following the recommendations of the NLLB paper: 71 | 72 | ```bash 73 | python filter.py source.txt merged.txt 74 | ``` 75 | 76 | ## License 77 | 78 | AGPLv3 79 | 80 | -------------------------------------------------------------------------------- /scripts/calculate_length_ratios.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | import time 3 | import os 4 | import urllib.request 5 | import json 6 | 7 | datasets_path = os.path.join(os.path.dirname(__file__), "datasets") 8 | if not os.path.isdir(datasets_path): 9 | os.mkdir(datasets_path) 10 | 11 | flores_dataset = os.path.join(datasets_path, "flores200_dataset", "dev") 12 | if not os.path.isdir(flores_dataset): 13 | # Download first 14 | print("Downloading flores200 dataset...") 15 | fname = os.path.join(datasets_path, "flores200.tar.gz") 16 | flores_url = "https://tinyurl.com/flores200dataset" 17 | urllib.request.urlretrieve(flores_url, fname) 18 | 19 | import tarfile 20 | with tarfile.open(fname) as f: 21 | f.extractall(datasets_path) 22 | 23 | if os.path.isfile(fname): 24 | os.unlink(fname) 25 | 26 | if not os.path.isdir(flores_dataset): 27 | print(f"Cannot download flores200. Please manually download it from {flores_url} and place it in {flores_dataset}") 28 | exit(1) 29 | 30 | nllb_langs = { 31 | "af":"afr_Latn", 32 | "ak":"aka_Latn", 33 | "am":"amh_Ethi", 34 | "ar":"arb_Arab", 35 | "as":"asm_Beng", 36 | "ay":"ayr_Latn", 37 | "az":"azj_Latn", 38 | "bm":"bam_Latn", 39 | "be":"bel_Cyrl", 40 | "bn":"ben_Beng", 41 | "bho":"bho_Deva", 42 | "bs":"bos_Latn", 43 | "bg":"bul_Cyrl", 44 | "ca":"cat_Latn", 45 | "ceb":"ceb_Latn", 46 | "cs":"ces_Latn", 47 | "ckb":"ckb_Arab", 48 | "tt":"crh_Latn", 49 | "cy":"cym_Latn", 50 | "da":"dan_Latn", 51 | "de":"deu_Latn", 52 | "el":"ell_Grek", 53 | "en":"eng_Latn", 54 | "eo":"epo_Latn", 55 | "et":"est_Latn", 56 | "eu":"eus_Latn", 57 | "ee":"ewe_Latn", 58 | "fa":"pes_Arab", 59 | "fi":"fin_Latn", 60 | "fr":"fra_Latn", 61 | "gd":"gla_Latn", 62 | "ga":"gle_Latn", 63 | "gl":"glg_Latn", 64 | "gn":"grn_Latn", 65 | "gu":"guj_Gujr", 66 | "ht":"hat_Latn", 67 | "ha":"hau_Latn", 68 | "he":"heb_Hebr", 69 | "hi":"hin_Deva", 70 | "hr":"hrv_Latn", 71 | "hu":"hun_Latn", 72 | "hy":"hye_Armn", 73 | "nl":"nld_Latn", 74 | "ig":"ibo_Latn", 75 | "ilo":"ilo_Latn", 76 | "id":"ind_Latn", 77 | "is":"isl_Latn", 78 | "it":"ita_Latn", 79 | "jv":"jav_Latn", 80 | "ja":"jpn_Jpan", 81 | "kab":"kab_Latn", 82 | "kn":"kan_Knda", 83 | "ka":"kat_Geor", 84 | "kk":"kaz_Cyrl", 85 | "km":"khm_Khmr", 86 | "rw":"kin_Latn", 87 | "ko":"kor_Hang", 88 | "ku":"kmr_Latn", 89 | "lo":"lao_Laoo", 90 | "lv":"lvs_Latn", 91 | "ln":"lin_Latn", 92 | "lt":"lit_Latn", 93 | "lb":"ltz_Latn", 94 | "lg":"lug_Latn", 95 | "lus":"lus_Latn", 96 | "mai":"mai_Deva", 97 | "ml":"mal_Mlym", 98 | "mr":"mar_Deva", 99 | "mk":"mkd_Cyrl", 100 | "mg":"plt_Latn", 101 | "mt":"mlt_Latn", 102 | "mni-Mtei":"mni_Beng", 103 | "mni":"mni_Beng", 104 | "mn":"khk_Cyrl", 105 | "mi":"mri_Latn", 106 | "ms":"zsm_Latn", 107 | "my":"mya_Mymr", 108 | "no":"nno_Latn", 109 | "ne":"npi_Deva", 110 | "ny":"nya_Latn", 111 | "om":"gaz_Latn", 112 | "or":"ory_Orya", 113 | "pl":"pol_Latn", 114 | "pt":"por_Latn", 115 | "ps":"pbt_Arab", 116 | "qu":"quy_Latn", 117 | "ro":"ron_Latn", 118 | "ru":"rus_Cyrl", 119 | "sa":"san_Deva", 120 | "si":"sin_Sinh", 121 | "sk":"slk_Latn", 122 | "sl":"slv_Latn", 123 | "sm":"smo_Latn", 124 | "sn":"sna_Latn", 125 | "sd":"snd_Arab", 126 | "so":"som_Latn", 127 | "es":"spa_Latn", 128 | "sq":"als_Latn", 129 | "sr":"srp_Cyrl", 130 | "su":"sun_Latn", 131 | "sv":"swe_Latn", 132 | "sw":"swh_Latn", 133 | "ta":"tam_Taml", 134 | "te":"tel_Telu", 135 | "tg":"tgk_Cyrl", 136 | "tl":"tgl_Latn", 137 | "th":"tha_Thai", 138 | "ti":"tir_Ethi", 139 | "ts":"tso_Latn", 140 | "tk":"tuk_Latn", 141 | "tr":"tur_Latn", 142 | "ug":"uig_Arab", 143 | "uk":"ukr_Cyrl", 144 | "ur":"urd_Arab", 145 | "uz":"uzn_Latn", 146 | "vi":"vie_Latn", 147 | "xh":"xho_Latn", 148 | "yi":"ydd_Hebr", 149 | "yo":"yor_Latn", 150 | "zh-CN":"zho_Hans", 151 | "zh":"zho_Hans", 152 | "zh-TW":"zho_Hant", 153 | "zu":"zul_Latn", 154 | "pa":"pan_Guru" 155 | } 156 | 157 | 158 | src_f = os.path.join(flores_dataset, nllb_langs["en"] + ".dev") 159 | src_text = [line.rstrip('\n') for line in open(src_f, encoding="utf-8")] 160 | src_len = 0 161 | for l in src_text: 162 | src_len += len(l) 163 | 164 | ratios = {} 165 | 166 | for lang in nllb_langs: 167 | if lang == "en": 168 | ratios["en"] = 1 169 | continue 170 | 171 | tgt_f = os.path.join(flores_dataset, nllb_langs[lang] + ".dev") 172 | tgt_text = [line.rstrip('\n') for line in open(tgt_f, encoding="utf-8")] 173 | 174 | tgt_len = 0 175 | for l in tgt_text: 176 | tgt_len += len(l) 177 | 178 | alpha = src_len / tgt_len 179 | 180 | ratios[lang] = alpha 181 | 182 | 183 | print(json.dumps(ratios)) 184 | -------------------------------------------------------------------------------- /filter.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | import argparse 3 | import random 4 | import os 5 | import re 6 | parser = argparse.ArgumentParser(description='Filter translation bitext') 7 | parser.add_argument('source', 8 | type=str, 9 | default=None, 10 | help='Source input .txt file') 11 | parser.add_argument('target', 12 | type=str, 13 | default=None, 14 | help='Target input .txt file') 15 | parser.add_argument('target_lang', 16 | type=str, 17 | default=None, 18 | help='Language code of target .txt file') 19 | parser.add_argument('--skip-length-filter', 20 | action='store_true', 21 | help='Skip length filtering') 22 | parser.add_argument('--force', 23 | action='store_true', 24 | help='Overwrite files') 25 | 26 | # Calculated with calculate_length_ratios.py (NLLB paper page 94) 27 | length_ratios = {"af": 0.942520082210963, "ak": 1.0009594320162465, "am": 1.4706905058384043, "ar": 1.1320246308536708, "as": 1.0344046930513096, "ay": 0.9534812874137485, "az": 0.9152745589729718, "bm": 1.038359777388881, "be": 0.8727361449982572, "bn": 1.0155668221456093, "bho": 1.0284986650236188, "bs": 0.9892614161655591, "bg": 0.9571845803324311, "ca": 0.9068940288452484, "ceb": 0.8333488650735539, "cs": 1.0277387842219758, "ckb": 1.0325363508152645, "tt": 0.968221928338863, "cy": 0.9366041236496394, "da": 0.9683642214040408, "de": 0.8542283601031674, "el": 0.8325840604383912, "en": 1, "eo": 0.9998722146793387, "et": 1.0172667365461652, "eu": 0.9371369543086412, "ee": 1.0212165458060412, "fa": 1.0518736346832465, "fi": 0.9346253480750424, "fr": 0.8414084185199373, "gd": 0.8047593641324959, "ga": 0.8615352854144445, "gl": 0.9034907301161171, "gn": 0.9859813820152157, "gu": 1.040828712286857, "ht": 1.083180481052085, "ha": 0.9302156242105419, "he": 1.2840278561245526, "hi": 0.9984926186165589, "hr": 1.0088967684744943, "hu": 0.9482238885101871, "hy": 0.8968758283245815, "nl": 0.899860558055288, "ig": 0.9882384515803101, "ilo": 0.8254368035867343, "id": 0.9180330273076585, "is": 1.0085716587448643, "it": 0.8511387585831803, "jv": 0.960282882827601, "ja": 2.2904972739580667, "kab": 1.0085066619407435, "kn": 0.9487053189151504, "ka": 0.9075777676286582, "kk": 0.9730985970230461, "km": 0.8304192093393473, "rw": 0.8921081697367015, "ko": 1.9868594372411166, "ku": 0.9972121327980629, "lo": 0.9994491589695281, "lv": 0.9763923226304584, "ln": 0.9247872591892211, "lt": 0.9942818113950792, "lb": 0.890363416542209, "lg": 0.9778871314196446, "lus": 0.9165879622511659, "mai": 1.0194951140065147, "ml": 0.8810150455306751, "mr": 0.9942502263377754, "mk": 0.9590396886801847, "mg": 0.8134657119465634, "mt": 0.9057392763867085, "mni-Mtei": 0.9695040733512994, "mni": 0.9695040733512994, "mn": 0.9524150050589962, "mi": 0.9040909911536379, "ms": 0.8900279391168964, "my": 0.8040564407879103, "no": 0.9815134219769193, "ne": 1.0364599718519745, "ny": 0.8848570519843093, "om": 0.8415837590750201, "or": 0.9704058537190339, "pl": 0.9379584191796216, "pt": 0.9199285772020193, "ps": 1.0240315403742966, "qu": 0.9361208939934349, "ro": 0.8872714386959603, "ru": 0.90653285252929, "sa": 1.0108599988695912, "si": 0.9834641277621977, "sk": 0.9910547481080396, "sl": 0.9980070788559038, "sm": 0.8544907277852477, "sn": 0.8904140766134194, "sd": 1.1047829156371338, "so": 0.8804016849389245, "es": 0.8389163254776089, "sq": 0.8886633210059697, "sr": 1.0054047108519848, "su": 0.9548775837083365, "sv": 0.9898089071258588, "sw": 0.9507731097542452, "ta": 0.8567420343808169, "te": 0.9842218221554861, "tg": 0.897229349119211, "tl": 0.791850882019949, "th": 1.0390664553022317, "ti": 1.4515751272508028, "ts": 0.8333821493236766, "tk": 0.9420165537998495, "tr": 0.9735526264629263, "ug": 0.9369265540105671, "uk": 0.9712791708043694, "ur": 1.0045253951697024, "uz": 0.8828166868812231, "vi": 0.9485040646710761, "xh": 0.9359249429970471, "yi": 0.927981617374546, "yo": 1.0230441106771047, "zh-CN": 2.9678076996017446, "zh": 2.9678076996017446, "zh-TW": 3.1976399673069063, "zu": 0.8916761037869562, "pa": 0.9904275181165153} 28 | 29 | args = parser.parse_args() 30 | 31 | if not args.target_lang in length_ratios: 32 | print("Language not available in length ratio database") 33 | exit(1) 34 | 35 | source_dst = os.path.splitext(args.source)[0] + ".filtered.txt" 36 | target_dst = os.path.splitext(args.target)[0] + ".filtered.txt" 37 | 38 | if os.path.isfile(source_dst) and not args.force: 39 | print("File exists: %s exiting... (use --force)" % source_dst) 40 | exit(1) 41 | if os.path.isfile(target_dst) and not args.force: 42 | pritn("File exists: %s exiting... (use --force)" % target_dst) 43 | exit(1) 44 | 45 | print("Reading %s" % args.source) 46 | print("Reading %s" % args.target) 47 | 48 | lines = [] 49 | with open(args.source, "r", encoding="utf-8") as fs: 50 | with open(args.target, "r", encoding="utf-8") as ft: 51 | while True: 52 | line = fs.readline().strip() 53 | linet = ft.readline().strip() 54 | if line == '' and linet == '': 55 | break 56 | elif (line == '' and linet != '') or (line != '' and linet == ''): 57 | print("Source and target must have the same number of lines") 58 | exit(1) 59 | 60 | lines.append((line, linet)) 61 | 62 | print("Read %s lines" % len(lines)) 63 | lr = length_ratios[args.target_lang] 64 | count = 0 65 | unknown_skip = 0 66 | length_ratio_skip = 0 67 | length_skip = 0 68 | duplicate_skip = 0 69 | 70 | src_filter_d = {} 71 | tgt_filter_d = {} 72 | 73 | with open(source_dst, "w", encoding="utf-8") as fs: 74 | with open(target_dst, "w", encoding="utf-8") as ft: 75 | for i in range(len(lines)): 76 | src, tgt = lines[i] 77 | len_tgt = len(tgt) * lr 78 | len_src = len(src) 79 | 80 | # Skip if unknown tokens were found 81 | if "⁇" in tgt: 82 | unknown_skip += 1 83 | continue 84 | 85 | if not args.skip_length_filter: 86 | # Skip is length ratio is exceeded 87 | thresh = 9.0 88 | if len_tgt / len_src > thresh or len_src / len_tgt > thresh: 89 | length_ratio_skip += 1 90 | continue 91 | 92 | # Skip really short translations 93 | if len_tgt < 15.0: 94 | length_skip += 1 95 | continue 96 | 97 | # Remove punctuation, non-printable chars 98 | src_k = re.sub(r'[^\w\s]+', '', src) 99 | if src_k in src_filter_d: 100 | duplicate_skip += 1 101 | continue 102 | src_filter_d[src_k] = True 103 | 104 | tgt_k = re.sub(r'[^\w\s]+', '', tgt) 105 | if tgt_k in tgt_filter_d: 106 | duplicate_skip += 1 107 | continue 108 | tgt_filter_d[tgt_k] = True 109 | 110 | # Filter prefix noise from NLLB 111 | if tgt.startswith("- ") and not src.startswith("- "): 112 | tgt = tgt[2:] 113 | 114 | fs.write(src + "\n") 115 | ft.write(tgt + "\n") 116 | count += 1 117 | 118 | print("Skipped: unknown (%s) length ratio (%s) length (%s) duplicate (%s)" % (unknown_skip, length_ratio_skip, length_skip, duplicate_skip)) 119 | 120 | print("Wrote %s" % source_dst) 121 | print("Wrote %s" % target_dst) 122 | 123 | print("Total lines: %s" % count) 124 | -------------------------------------------------------------------------------- /server/main.js: -------------------------------------------------------------------------------- 1 | const { once } = require('events'); 2 | const express = require('express'); 3 | const fs = require('fs'); 4 | const promisify = require('util').promisify; 5 | const readline = require('readline'); 6 | const app = express(); 7 | app.use(express.json()); 8 | 9 | const readFile = promisify(fs.readFile); 10 | const exists = promisify(fs.exists); 11 | const readdir = promisify(fs.readdir); 12 | const writeFile = promisify(fs.writeFile); 13 | const mkdir = promisify(fs.mkdir); 14 | const stat = promisify(fs.stat); 15 | 16 | const clone = (obj) => { 17 | return JSON.parse(JSON.stringify(obj)); 18 | } 19 | 20 | const argv = require('minimist')(process.argv.slice(2), { 21 | string: ["port", "batch-size"], 22 | alias: { 23 | p: "port", 24 | b: "batch-size" 25 | }, 26 | default: {port: 3000, 'batch-size': 10000} 27 | }); 28 | 29 | let datasets = {}; 30 | 31 | let getDatasetLangs = async(d) => { 32 | if (!d) throw new Error("Invalid call to getDatasetLangs"); 33 | 34 | return (await readdir(`data/${d}`)).filter(d => !d.endsWith(".txt")); 35 | } 36 | 37 | let initBatchesForLang = async(d, lang, numPhrases) => { 38 | let bs = parseInt(argv['batch-size']); 39 | let numBatches = Math.ceil(numPhrases / bs); 40 | lang = sanitize(lang); 41 | 42 | let batches = new Array(numBatches); 43 | for (let idx = 0; idx < batches.length; idx++){ 44 | batches[idx] = { 45 | batchId: idx, 46 | range: [idx * bs, Math.min((idx + 1) * bs - 1, numPhrases - 1)], 47 | done: await exists(`data/${d}/${lang}/${idx}.txt`) 48 | } 49 | } 50 | 51 | return batches; 52 | } 53 | 54 | let initBatches = async (d, numPhrases) => { 55 | let langs = await getDatasetLangs(d); 56 | let batches = {}; 57 | 58 | for (let i = 0; i < langs.length; i++){ 59 | batches[langs[i]] = await initBatchesForLang(d, langs[i], numPhrases); 60 | } 61 | 62 | return batches; 63 | } 64 | 65 | let sanitize = d => { 66 | return d.replace(/[^A-Za-z0-9-_]/g, ""); 67 | } 68 | 69 | let getDataset = async (d) =>{ 70 | if (datasets[d]) return datasets[d]; 71 | else{ 72 | d = sanitize(d); 73 | let source = `data/${d}/source.txt`; 74 | if (await exists(source)){ 75 | return new Promise((resolve, reject) => { 76 | try{ 77 | console.log(`Reading ${source}`); 78 | const phrases = []; 79 | const instream = fs.createReadStream(source); 80 | const rl = readline.createInterface({input: instream, crlfDelay: Infinity}); 81 | rl.on('line', line => { 82 | line = line.trim(); 83 | if (line !== "") phrases.push(line); 84 | }); 85 | rl.on('close', async () => { 86 | console.log(`Read ${phrases.length} phrases from ${source}`); 87 | 88 | let batches = await initBatches(d, phrases.length); 89 | 90 | datasets[d] = { 91 | phrases, 92 | batches 93 | }; 94 | 95 | resolve(datasets[d]); 96 | }); 97 | }catch(e){ 98 | reject(e); 99 | } 100 | }); 101 | 102 | }else{ 103 | throw new Error(`${d} does not exist`); 104 | } 105 | } 106 | } 107 | 108 | let getBatchesForLang = async (d, batches, lang, numPhrases) => { 109 | if (batches[lang]) return batches[lang]; 110 | else{ 111 | batches[lang] = await initBatchesForLang(d, lang, numPhrases); 112 | return batches[lang]; 113 | } 114 | } 115 | 116 | let handler = f => { 117 | return async (req, res, next) => { 118 | try{ 119 | await f(req, res); 120 | }catch(e){ 121 | next(e); 122 | } 123 | }; 124 | } 125 | 126 | app.get('/', (req, res) => { 127 | res.send("nllu-server running"); 128 | }) 129 | 130 | app.get('/checkout', handler(async (req, res) => { 131 | const { dataset, lang } = req.query; 132 | const timeout = parseInt(req.query.timeout); 133 | 134 | if (!dataset) throw new Error("Invalid dataset"); 135 | if (!lang) throw new Error("Invalid lang"); 136 | if (!timeout) throw new Error("Invalid timeout"); 137 | 138 | let { batches, phrases } = await getDataset(req.query.dataset); 139 | batches = await getBatchesForLang(dataset, batches, lang, phrases.length); 140 | 141 | // Any batches left? 142 | let now = new Date().getTime(); 143 | 144 | let batch = batches.find(b => !b.done && (!b.timeout || b.timeout < now)); 145 | if (batch){ 146 | 147 | // Set expiry timeout 148 | batch.timeout = now + timeout * 1000; 149 | 150 | batchRes = clone(batch); 151 | batchRes.phrases = phrases.slice(batch.range[0], batch.range[1] + 1); 152 | 153 | res.json(batchRes); 154 | }else{ 155 | res.json({done: batches.find(b => !b.done) === undefined}); 156 | } 157 | })); 158 | 159 | app.post('/commit', handler(async (req, res) => { 160 | let { dataset, batchId, phrases, lang} = req.body; 161 | batchId = parseInt(batchId); 162 | lang = sanitize(lang); 163 | dataset = sanitize(dataset); 164 | if (!dataset) throw new Error("Invalid dataset") 165 | if (isNaN(batchId)) throw new Error("Invalid batchId") 166 | if (!phrases) throw new Error("Invalid phrases") 167 | if (!lang) throw new Error("Invalid lang"); 168 | 169 | const ds = await getDataset(dataset); 170 | const batches = await getBatchesForLang(dataset, ds.batches, lang, ds.phrases.length); 171 | const batch = batches.find(b => b.batchId === batchId); 172 | if (!batch) throw new Error("Invalid batchId"); 173 | if (phrases.length !== batch.range[1] - batch.range[0] + 1) throw new Error("Phrase length must match batch phrase length"); 174 | 175 | // All good, write to file 176 | let destDir = `data/${dataset}/${lang}`; 177 | if (!(await exists(destDir))){ 178 | await mkdir(destDir, { recursive: true }); 179 | } 180 | 181 | const fname = `${destDir}/${batchId}.txt`; 182 | await writeFile(fname, phrases.join("\n") + "\n"); 183 | console.log(`Wrote ${fname}`); 184 | 185 | // Clear timeout, mark done 186 | delete(batch.timeout); 187 | batch.done = true; 188 | 189 | res.json({success: true}); 190 | })); 191 | 192 | app.get('/download', handler(async (req, res) => { 193 | let { dataset, lang } = req.query; 194 | dataset = sanitize(dataset); 195 | lang = sanitize(lang); 196 | if (!dataset) throw new Error("Invalid dataset"); 197 | if (!lang) throw new Error("Invalid lang"); 198 | 199 | const ds = await getDataset(dataset); 200 | const batches = await getBatchesForLang(dataset, ds.batches, lang, ds.phrases.length); 201 | 202 | if (!batches.find(b => !b.done)){ 203 | for (let idx = 0; idx < batches.length; idx++){ 204 | const filePath = `data/${dataset}/${lang}/${idx}.txt`; 205 | if (!await exists(filePath)) throw new Error(`batch ${idx} is missing (this should have not happened)`); 206 | } 207 | 208 | const fname = `${dataset}-${lang}.txt`; 209 | res.setHeader('Content-Disposition', `attachment; filename=${fname}`); 210 | res.setHeader('Content-Type', 'text/plain'); 211 | // res.setHeader('Content-Length', ); 212 | console.log(`Downloading ${batches.length} batches from ${dataset}/${lang}`); 213 | 214 | let sendFile = (idx) => { 215 | if (idx >= batches.length){ 216 | res.end(); 217 | return; 218 | } 219 | 220 | const filePath = `data/${dataset}/${lang}/${idx}.txt`; 221 | const filestream = fs.createReadStream(filePath); 222 | 223 | filestream.on('error', (error) => { 224 | console.error("Error: ", error); 225 | res.status(500).send(`Error while downloading ${filePath}`); 226 | }); 227 | 228 | filestream.pipe(res, { end: false }); 229 | filestream.on('end', () => { 230 | sendFile(idx + 1); 231 | }); 232 | } 233 | sendFile(0); 234 | }else{ 235 | res.json({error: `${dataset} - ${lang} not done`}); 236 | } 237 | })); 238 | 239 | app.use((err, req, res, next) => { 240 | console.log(err.message); 241 | res.json({error: err.message}); 242 | }); 243 | 244 | app.listen(argv.port, () => { 245 | console.log('Listening on port ' + argv.port); 246 | }); 247 | 248 | -------------------------------------------------------------------------------- /translate.py: -------------------------------------------------------------------------------- 1 | import requests 2 | import ctranslate2 3 | import sentencepiece as spm 4 | import argparse 5 | import os 6 | import time 7 | 8 | parser = argparse.ArgumentParser(description='Translate NLLU datasets') 9 | parser.add_argument('--server', 10 | type=str, 11 | default="http://localhost:3000", 12 | help='URL endpoint of nllu-server. Default: %(default)s') 13 | parser.add_argument('--dataset', 14 | type=str, 15 | default="test-ds", 16 | help='Source nllu-server dataset name. Default: %(default)s') 17 | parser.add_argument('--target-lang', 18 | type=str, 19 | default="it", 20 | help='Target language code to translate to. Default: %(default)s') 21 | parser.add_argument('--device-index', 22 | type=str, 23 | default=None, 24 | help='CUDA device indexes. Default: %(default)s') 25 | parser.add_argument('--batch-size', 26 | type=int, 27 | default=64, 28 | help='Batch size. Default: %(default)s') 29 | parser.add_argument('--split', 30 | action='store_true', 31 | default=False, 32 | help='Split input in batch sizes chunks. Default: %(default)s') 33 | parser.add_argument('--checkout-timeout', 34 | type=int, 35 | default=3600, 36 | help='Checkout timeout') 37 | parser.add_argument('--model', 38 | type=str, 39 | default='./model', 40 | help='NLLB + sentencepiece model directory. Default: %(default)s') 41 | parser.add_argument('--beam-size', 42 | type=int, 43 | default=4, 44 | help='Beam size. Default: %(default)s') 45 | args = parser.parse_args() 46 | 47 | nllb_langs = { 48 | "af":"afr_Latn", 49 | "ak":"aka_Latn", 50 | "am":"amh_Ethi", 51 | "ar":"arb_Arab", 52 | "as":"asm_Beng", 53 | "ay":"ayr_Latn", 54 | "az":"azj_Latn", 55 | "bm":"bam_Latn", 56 | "be":"bel_Cyrl", 57 | "bn":"ben_Beng", 58 | "bho":"bho_Deva", 59 | "bs":"bos_Latn", 60 | "bg":"bul_Cyrl", 61 | "ca":"cat_Latn", 62 | "ceb":"ceb_Latn", 63 | "cs":"ces_Latn", 64 | "ckb":"ckb_Arab", 65 | "tt":"crh_Latn", 66 | "cy":"cym_Latn", 67 | "da":"dan_Latn", 68 | "de":"deu_Latn", 69 | "el":"ell_Grek", 70 | "en":"eng_Latn", 71 | "eo":"epo_Latn", 72 | "et":"est_Latn", 73 | "eu":"eus_Latn", 74 | "ee":"ewe_Latn", 75 | "fa":"pes_Arab", 76 | "fi":"fin_Latn", 77 | "fr":"fra_Latn", 78 | "gd":"gla_Latn", 79 | "ga":"gle_Latn", 80 | "gl":"glg_Latn", 81 | "gn":"grn_Latn", 82 | "gu":"guj_Gujr", 83 | "ht":"hat_Latn", 84 | "ha":"hau_Latn", 85 | "he":"heb_Hebr", 86 | "hi":"hin_Deva", 87 | "hr":"hrv_Latn", 88 | "hu":"hun_Latn", 89 | "hy":"hye_Armn", 90 | "nl":"nld_Latn", 91 | "ig":"ibo_Latn", 92 | "ilo":"ilo_Latn", 93 | "id":"ind_Latn", 94 | "is":"isl_Latn", 95 | "it":"ita_Latn", 96 | "jv":"jav_Latn", 97 | "ja":"jpn_Jpan", 98 | "kab":"kab_Latn", 99 | "kn":"kan_Knda", 100 | "ka":"kat_Geor", 101 | "kk":"kaz_Cyrl", 102 | "km":"khm_Khmr", 103 | "rw":"kin_Latn", 104 | "ko":"kor_Hang", 105 | "ku":"kmr_Latn", 106 | "lo":"lao_Laoo", 107 | "lv":"lvs_Latn", 108 | "ln":"lin_Latn", 109 | "lt":"lit_Latn", 110 | "lb":"ltz_Latn", 111 | "lg":"lug_Latn", 112 | "lus":"lus_Latn", 113 | "mai":"mai_Deva", 114 | "ml":"mal_Mlym", 115 | "mr":"mar_Deva", 116 | "mk":"mkd_Cyrl", 117 | "mg":"plt_Latn", 118 | "mt":"mlt_Latn", 119 | "mni-Mtei":"mni_Beng", 120 | "mni":"mni_Beng", 121 | "mn":"khk_Cyrl", 122 | "mi":"mri_Latn", 123 | "ms":"zsm_Latn", 124 | "my":"mya_Mymr", 125 | "no":"nno_Latn", 126 | "ne":"npi_Deva", 127 | "ny":"nya_Latn", 128 | "om":"gaz_Latn", 129 | "or":"ory_Orya", 130 | "pl":"pol_Latn", 131 | "pt":"por_Latn", 132 | "ps":"pbt_Arab", 133 | "qu":"quy_Latn", 134 | "ro":"ron_Latn", 135 | "ru":"rus_Cyrl", 136 | "sa":"san_Deva", 137 | "si":"sin_Sinh", 138 | "sk":"slk_Latn", 139 | "sl":"slv_Latn", 140 | "sm":"smo_Latn", 141 | "sn":"sna_Latn", 142 | "sd":"snd_Arab", 143 | "so":"som_Latn", 144 | "es":"spa_Latn", 145 | "sq":"als_Latn", 146 | "sr":"srp_Cyrl", 147 | "su":"sun_Latn", 148 | "sv":"swe_Latn", 149 | "sw":"swh_Latn", 150 | "ta":"tam_Taml", 151 | "te":"tel_Telu", 152 | "tg":"tgk_Cyrl", 153 | "tl":"tgl_Latn", 154 | "th":"tha_Thai", 155 | "ti":"tir_Ethi", 156 | "ts":"tso_Latn", 157 | "tk":"tuk_Latn", 158 | "tr":"tur_Latn", 159 | "ug":"uig_Arab", 160 | "uk":"ukr_Cyrl", 161 | "ur":"urd_Arab", 162 | "uz":"uzn_Latn", 163 | "vi":"vie_Latn", 164 | "xh":"xho_Latn", 165 | "yi":"ydd_Hebr", 166 | "yo":"yor_Latn", 167 | "zh-CN":"zho_Hans", 168 | "zh":"zho_Hans", 169 | "zh-TW":"zho_Hant", 170 | "zu":"zul_Latn", 171 | "pa":"pan_Guru" 172 | } 173 | 174 | batch_size = args.batch_size 175 | tgt_lang = nllb_langs[args.target_lang] 176 | src_lang = nllb_langs["en"] 177 | ct_model_path = args.model 178 | sp_model_path = os.path.join(os.path.join(args.model, "sp.model")) 179 | 180 | print("NLLU-server: %s" % args.server) 181 | print("Target lang: %s" % args.target_lang) 182 | device = "cuda" if ctranslate2.get_cuda_device_count() > 0 else "cpu" 183 | print("Running on %s" % device) 184 | device_index = [0] 185 | if device == "cuda": 186 | device_index = [0] 187 | if args.device_index is not None: 188 | device_index = [int(d) for d in args.device_index.split(",")] 189 | print("Device index: %s" % device_index) 190 | 191 | sp = spm.SentencePieceProcessor() 192 | sp.load(sp_model_path) 193 | 194 | def s_req(func, endpoint, **kwargs): 195 | retries = 0 196 | while retries < 10: 197 | try: 198 | r = func(f'{args.server}{endpoint}', timeout=60, **kwargs) 199 | res = r.json() 200 | if 'error' in res: 201 | print("Server: " + res['error']) 202 | exit(1) 203 | return res 204 | except Exception as e: 205 | print(e) 206 | print("Retrying...") 207 | retries += 1 208 | time.sleep(10) 209 | print("Too many retries, quitting") 210 | exit(1) 211 | 212 | def s_get(endpoint): 213 | return s_req(requests.get, endpoint) 214 | 215 | def s_post(endpoint, data): 216 | return s_req(requests.post, endpoint, json=data) 217 | 218 | # Fetch from server 219 | translator = ctranslate2.Translator(ct_model_path, device=device, device_index=device_index, compute_type="auto", inter_threads=os.cpu_count()) 220 | 221 | while True: 222 | res = s_get(f'/checkout?dataset={args.dataset}&lang={args.target_lang}&timeout={args.checkout_timeout}') 223 | if res['done']: 224 | print("Done!") 225 | exit(0) 226 | if not 'batchId' in res: 227 | print("Done (empty batchId)") 228 | exit(0) 229 | 230 | print("Batch ID: %s" % res['batchId']) 231 | print("Range: %s" % res['range']) 232 | 233 | now = time.time() 234 | print("Translating...") 235 | translations = [] 236 | 237 | def translate_phrases(phrases): 238 | global batch_size, translations 239 | if len(phrases) == 0: 240 | return [] 241 | 242 | src_text = [sent.strip() for sent in phrases] 243 | tgt_prefix = [[tgt_lang]] * len(src_text) 244 | 245 | # Subword the source sentences 246 | src_subworded = sp.encode_as_pieces(src_text) 247 | src_subworded = [[src_lang] + sent + [""] for sent in src_subworded] 248 | 249 | # Translate the source sentences 250 | while True: 251 | try: 252 | translations_subworded = translator.translate_batch(src_subworded, batch_type="tokens", max_batch_size=batch_size, beam_size=args.beam_size, target_prefix=tgt_prefix, return_scores=False) 253 | break 254 | except RuntimeError as e: 255 | if "out of memory" in str(e) and batch_size > 1: 256 | batch_size //= 2 257 | print(str(e) + f", setting batch size to {batch_size}") 258 | translations_subworded = [translation.hypotheses[0] for translation in translations_subworded] 259 | for translation in translations_subworded: 260 | if tgt_lang in translation: 261 | translation.remove(tgt_lang) 262 | 263 | # Desubword the target sentences 264 | translations += sp.decode(translations_subworded) 265 | 266 | while True: 267 | try: 268 | if args.split: 269 | i = 0 270 | while i < len(res['phrases']): 271 | translate_phrases(res['phrases'][i:i+batch_size]) 272 | i += batch_size 273 | else: 274 | translate_phrases(res['phrases']) 275 | break 276 | except RuntimeError as e: 277 | if "out of memory" in str(e) and batch_size > 1: 278 | batch_size //= 2 279 | translations = [] 280 | print(str(e) + f", setting batch size to {batch_size}") 281 | else: 282 | print(str(e)) 283 | exit(1) 284 | 285 | print("Completed in %s seconds, committing..." % (time.time() - now)) 286 | 287 | s_post('/commit', { 288 | 'dataset': args.dataset, 'batchId': res['batchId'], 'phrases': translations, 'lang': args.target_lang 289 | }) 290 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | GNU AFFERO GENERAL PUBLIC LICENSE 2 | Version 3, 19 November 2007 3 | 4 | Copyright (C) 2007 Free Software Foundation, Inc. 5 | Everyone is permitted to copy and distribute verbatim copies 6 | of this license document, but changing it is not allowed. 7 | 8 | Preamble 9 | 10 | The GNU Affero General Public License is a free, copyleft license for 11 | software and other kinds of works, specifically designed to ensure 12 | cooperation with the community in the case of network server software. 13 | 14 | The licenses for most software and other practical works are designed 15 | to take away your freedom to share and change the works. By contrast, 16 | our General Public Licenses are intended to guarantee your freedom to 17 | share and change all versions of a program--to make sure it remains free 18 | software for all its users. 19 | 20 | When we speak of free software, we are referring to freedom, not 21 | price. Our General Public Licenses are designed to make sure that you 22 | have the freedom to distribute copies of free software (and charge for 23 | them if you wish), that you receive source code or can get it if you 24 | want it, that you can change the software or use pieces of it in new 25 | free programs, and that you know you can do these things. 26 | 27 | Developers that use our General Public Licenses protect your rights 28 | with two steps: (1) assert copyright on the software, and (2) offer 29 | you this License which gives you legal permission to copy, distribute 30 | and/or modify the software. 31 | 32 | A secondary benefit of defending all users' freedom is that 33 | improvements made in alternate versions of the program, if they 34 | receive widespread use, become available for other developers to 35 | incorporate. Many developers of free software are heartened and 36 | encouraged by the resulting cooperation. However, in the case of 37 | software used on network servers, this result may fail to come about. 38 | The GNU General Public License permits making a modified version and 39 | letting the public access it on a server without ever releasing its 40 | source code to the public. 41 | 42 | The GNU Affero General Public License is designed specifically to 43 | ensure that, in such cases, the modified source code becomes available 44 | to the community. It requires the operator of a network server to 45 | provide the source code of the modified version running there to the 46 | users of that server. Therefore, public use of a modified version, on 47 | a publicly accessible server, gives the public access to the source 48 | code of the modified version. 49 | 50 | An older license, called the Affero General Public License and 51 | published by Affero, was designed to accomplish similar goals. This is 52 | a different license, not a version of the Affero GPL, but Affero has 53 | released a new version of the Affero GPL which permits relicensing under 54 | this license. 55 | 56 | The precise terms and conditions for copying, distribution and 57 | modification follow. 58 | 59 | TERMS AND CONDITIONS 60 | 61 | 0. Definitions. 62 | 63 | "This License" refers to version 3 of the GNU Affero General Public License. 64 | 65 | "Copyright" also means copyright-like laws that apply to other kinds of 66 | works, such as semiconductor masks. 67 | 68 | "The Program" refers to any copyrightable work licensed under this 69 | License. Each licensee is addressed as "you". "Licensees" and 70 | "recipients" may be individuals or organizations. 71 | 72 | To "modify" a work means to copy from or adapt all or part of the work 73 | in a fashion requiring copyright permission, other than the making of an 74 | exact copy. The resulting work is called a "modified version" of the 75 | earlier work or a work "based on" the earlier work. 76 | 77 | A "covered work" means either the unmodified Program or a work based 78 | on the Program. 79 | 80 | To "propagate" a work means to do anything with it that, without 81 | permission, would make you directly or secondarily liable for 82 | infringement under applicable copyright law, except executing it on a 83 | computer or modifying a private copy. Propagation includes copying, 84 | distribution (with or without modification), making available to the 85 | public, and in some countries other activities as well. 86 | 87 | To "convey" a work means any kind of propagation that enables other 88 | parties to make or receive copies. Mere interaction with a user through 89 | a computer network, with no transfer of a copy, is not conveying. 90 | 91 | An interactive user interface displays "Appropriate Legal Notices" 92 | to the extent that it includes a convenient and prominently visible 93 | feature that (1) displays an appropriate copyright notice, and (2) 94 | tells the user that there is no warranty for the work (except to the 95 | extent that warranties are provided), that licensees may convey the 96 | work under this License, and how to view a copy of this License. If 97 | the interface presents a list of user commands or options, such as a 98 | menu, a prominent item in the list meets this criterion. 99 | 100 | 1. Source Code. 101 | 102 | The "source code" for a work means the preferred form of the work 103 | for making modifications to it. "Object code" means any non-source 104 | form of a work. 105 | 106 | A "Standard Interface" means an interface that either is an official 107 | standard defined by a recognized standards body, or, in the case of 108 | interfaces specified for a particular programming language, one that 109 | is widely used among developers working in that language. 110 | 111 | The "System Libraries" of an executable work include anything, other 112 | than the work as a whole, that (a) is included in the normal form of 113 | packaging a Major Component, but which is not part of that Major 114 | Component, and (b) serves only to enable use of the work with that 115 | Major Component, or to implement a Standard Interface for which an 116 | implementation is available to the public in source code form. A 117 | "Major Component", in this context, means a major essential component 118 | (kernel, window system, and so on) of the specific operating system 119 | (if any) on which the executable work runs, or a compiler used to 120 | produce the work, or an object code interpreter used to run it. 121 | 122 | The "Corresponding Source" for a work in object code form means all 123 | the source code needed to generate, install, and (for an executable 124 | work) run the object code and to modify the work, including scripts to 125 | control those activities. However, it does not include the work's 126 | System Libraries, or general-purpose tools or generally available free 127 | programs which are used unmodified in performing those activities but 128 | which are not part of the work. For example, Corresponding Source 129 | includes interface definition files associated with source files for 130 | the work, and the source code for shared libraries and dynamically 131 | linked subprograms that the work is specifically designed to require, 132 | such as by intimate data communication or control flow between those 133 | subprograms and other parts of the work. 134 | 135 | The Corresponding Source need not include anything that users 136 | can regenerate automatically from other parts of the Corresponding 137 | Source. 138 | 139 | The Corresponding Source for a work in source code form is that 140 | same work. 141 | 142 | 2. Basic Permissions. 143 | 144 | All rights granted under this License are granted for the term of 145 | copyright on the Program, and are irrevocable provided the stated 146 | conditions are met. This License explicitly affirms your unlimited 147 | permission to run the unmodified Program. The output from running a 148 | covered work is covered by this License only if the output, given its 149 | content, constitutes a covered work. This License acknowledges your 150 | rights of fair use or other equivalent, as provided by copyright law. 151 | 152 | You may make, run and propagate covered works that you do not 153 | convey, without conditions so long as your license otherwise remains 154 | in force. You may convey covered works to others for the sole purpose 155 | of having them make modifications exclusively for you, or provide you 156 | with facilities for running those works, provided that you comply with 157 | the terms of this License in conveying all material for which you do 158 | not control copyright. Those thus making or running the covered works 159 | for you must do so exclusively on your behalf, under your direction 160 | and control, on terms that prohibit them from making any copies of 161 | your copyrighted material outside their relationship with you. 162 | 163 | Conveying under any other circumstances is permitted solely under 164 | the conditions stated below. Sublicensing is not allowed; section 10 165 | makes it unnecessary. 166 | 167 | 3. Protecting Users' Legal Rights From Anti-Circumvention Law. 168 | 169 | No covered work shall be deemed part of an effective technological 170 | measure under any applicable law fulfilling obligations under article 171 | 11 of the WIPO copyright treaty adopted on 20 December 1996, or 172 | similar laws prohibiting or restricting circumvention of such 173 | measures. 174 | 175 | When you convey a covered work, you waive any legal power to forbid 176 | circumvention of technological measures to the extent such circumvention 177 | is effected by exercising rights under this License with respect to 178 | the covered work, and you disclaim any intention to limit operation or 179 | modification of the work as a means of enforcing, against the work's 180 | users, your or third parties' legal rights to forbid circumvention of 181 | technological measures. 182 | 183 | 4. Conveying Verbatim Copies. 184 | 185 | You may convey verbatim copies of the Program's source code as you 186 | receive it, in any medium, provided that you conspicuously and 187 | appropriately publish on each copy an appropriate copyright notice; 188 | keep intact all notices stating that this License and any 189 | non-permissive terms added in accord with section 7 apply to the code; 190 | keep intact all notices of the absence of any warranty; and give all 191 | recipients a copy of this License along with the Program. 192 | 193 | You may charge any price or no price for each copy that you convey, 194 | and you may offer support or warranty protection for a fee. 195 | 196 | 5. Conveying Modified Source Versions. 197 | 198 | You may convey a work based on the Program, or the modifications to 199 | produce it from the Program, in the form of source code under the 200 | terms of section 4, provided that you also meet all of these conditions: 201 | 202 | a) The work must carry prominent notices stating that you modified 203 | it, and giving a relevant date. 204 | 205 | b) The work must carry prominent notices stating that it is 206 | released under this License and any conditions added under section 207 | 7. This requirement modifies the requirement in section 4 to 208 | "keep intact all notices". 209 | 210 | c) You must license the entire work, as a whole, under this 211 | License to anyone who comes into possession of a copy. This 212 | License will therefore apply, along with any applicable section 7 213 | additional terms, to the whole of the work, and all its parts, 214 | regardless of how they are packaged. This License gives no 215 | permission to license the work in any other way, but it does not 216 | invalidate such permission if you have separately received it. 217 | 218 | d) If the work has interactive user interfaces, each must display 219 | Appropriate Legal Notices; however, if the Program has interactive 220 | interfaces that do not display Appropriate Legal Notices, your 221 | work need not make them do so. 222 | 223 | A compilation of a covered work with other separate and independent 224 | works, which are not by their nature extensions of the covered work, 225 | and which are not combined with it such as to form a larger program, 226 | in or on a volume of a storage or distribution medium, is called an 227 | "aggregate" if the compilation and its resulting copyright are not 228 | used to limit the access or legal rights of the compilation's users 229 | beyond what the individual works permit. Inclusion of a covered work 230 | in an aggregate does not cause this License to apply to the other 231 | parts of the aggregate. 232 | 233 | 6. Conveying Non-Source Forms. 234 | 235 | You may convey a covered work in object code form under the terms 236 | of sections 4 and 5, provided that you also convey the 237 | machine-readable Corresponding Source under the terms of this License, 238 | in one of these ways: 239 | 240 | a) Convey the object code in, or embodied in, a physical product 241 | (including a physical distribution medium), accompanied by the 242 | Corresponding Source fixed on a durable physical medium 243 | customarily used for software interchange. 244 | 245 | b) Convey the object code in, or embodied in, a physical product 246 | (including a physical distribution medium), accompanied by a 247 | written offer, valid for at least three years and valid for as 248 | long as you offer spare parts or customer support for that product 249 | model, to give anyone who possesses the object code either (1) a 250 | copy of the Corresponding Source for all the software in the 251 | product that is covered by this License, on a durable physical 252 | medium customarily used for software interchange, for a price no 253 | more than your reasonable cost of physically performing this 254 | conveying of source, or (2) access to copy the 255 | Corresponding Source from a network server at no charge. 256 | 257 | c) Convey individual copies of the object code with a copy of the 258 | written offer to provide the Corresponding Source. This 259 | alternative is allowed only occasionally and noncommercially, and 260 | only if you received the object code with such an offer, in accord 261 | with subsection 6b. 262 | 263 | d) Convey the object code by offering access from a designated 264 | place (gratis or for a charge), and offer equivalent access to the 265 | Corresponding Source in the same way through the same place at no 266 | further charge. You need not require recipients to copy the 267 | Corresponding Source along with the object code. If the place to 268 | copy the object code is a network server, the Corresponding Source 269 | may be on a different server (operated by you or a third party) 270 | that supports equivalent copying facilities, provided you maintain 271 | clear directions next to the object code saying where to find the 272 | Corresponding Source. Regardless of what server hosts the 273 | Corresponding Source, you remain obligated to ensure that it is 274 | available for as long as needed to satisfy these requirements. 275 | 276 | e) Convey the object code using peer-to-peer transmission, provided 277 | you inform other peers where the object code and Corresponding 278 | Source of the work are being offered to the general public at no 279 | charge under subsection 6d. 280 | 281 | A separable portion of the object code, whose source code is excluded 282 | from the Corresponding Source as a System Library, need not be 283 | included in conveying the object code work. 284 | 285 | A "User Product" is either (1) a "consumer product", which means any 286 | tangible personal property which is normally used for personal, family, 287 | or household purposes, or (2) anything designed or sold for incorporation 288 | into a dwelling. In determining whether a product is a consumer product, 289 | doubtful cases shall be resolved in favor of coverage. For a particular 290 | product received by a particular user, "normally used" refers to a 291 | typical or common use of that class of product, regardless of the status 292 | of the particular user or of the way in which the particular user 293 | actually uses, or expects or is expected to use, the product. A product 294 | is a consumer product regardless of whether the product has substantial 295 | commercial, industrial or non-consumer uses, unless such uses represent 296 | the only significant mode of use of the product. 297 | 298 | "Installation Information" for a User Product means any methods, 299 | procedures, authorization keys, or other information required to install 300 | and execute modified versions of a covered work in that User Product from 301 | a modified version of its Corresponding Source. The information must 302 | suffice to ensure that the continued functioning of the modified object 303 | code is in no case prevented or interfered with solely because 304 | modification has been made. 305 | 306 | If you convey an object code work under this section in, or with, or 307 | specifically for use in, a User Product, and the conveying occurs as 308 | part of a transaction in which the right of possession and use of the 309 | User Product is transferred to the recipient in perpetuity or for a 310 | fixed term (regardless of how the transaction is characterized), the 311 | Corresponding Source conveyed under this section must be accompanied 312 | by the Installation Information. But this requirement does not apply 313 | if neither you nor any third party retains the ability to install 314 | modified object code on the User Product (for example, the work has 315 | been installed in ROM). 316 | 317 | The requirement to provide Installation Information does not include a 318 | requirement to continue to provide support service, warranty, or updates 319 | for a work that has been modified or installed by the recipient, or for 320 | the User Product in which it has been modified or installed. Access to a 321 | network may be denied when the modification itself materially and 322 | adversely affects the operation of the network or violates the rules and 323 | protocols for communication across the network. 324 | 325 | Corresponding Source conveyed, and Installation Information provided, 326 | in accord with this section must be in a format that is publicly 327 | documented (and with an implementation available to the public in 328 | source code form), and must require no special password or key for 329 | unpacking, reading or copying. 330 | 331 | 7. Additional Terms. 332 | 333 | "Additional permissions" are terms that supplement the terms of this 334 | License by making exceptions from one or more of its conditions. 335 | Additional permissions that are applicable to the entire Program shall 336 | be treated as though they were included in this License, to the extent 337 | that they are valid under applicable law. If additional permissions 338 | apply only to part of the Program, that part may be used separately 339 | under those permissions, but the entire Program remains governed by 340 | this License without regard to the additional permissions. 341 | 342 | When you convey a copy of a covered work, you may at your option 343 | remove any additional permissions from that copy, or from any part of 344 | it. (Additional permissions may be written to require their own 345 | removal in certain cases when you modify the work.) You may place 346 | additional permissions on material, added by you to a covered work, 347 | for which you have or can give appropriate copyright permission. 348 | 349 | Notwithstanding any other provision of this License, for material you 350 | add to a covered work, you may (if authorized by the copyright holders of 351 | that material) supplement the terms of this License with terms: 352 | 353 | a) Disclaiming warranty or limiting liability differently from the 354 | terms of sections 15 and 16 of this License; or 355 | 356 | b) Requiring preservation of specified reasonable legal notices or 357 | author attributions in that material or in the Appropriate Legal 358 | Notices displayed by works containing it; or 359 | 360 | c) Prohibiting misrepresentation of the origin of that material, or 361 | requiring that modified versions of such material be marked in 362 | reasonable ways as different from the original version; or 363 | 364 | d) Limiting the use for publicity purposes of names of licensors or 365 | authors of the material; or 366 | 367 | e) Declining to grant rights under trademark law for use of some 368 | trade names, trademarks, or service marks; or 369 | 370 | f) Requiring indemnification of licensors and authors of that 371 | material by anyone who conveys the material (or modified versions of 372 | it) with contractual assumptions of liability to the recipient, for 373 | any liability that these contractual assumptions directly impose on 374 | those licensors and authors. 375 | 376 | All other non-permissive additional terms are considered "further 377 | restrictions" within the meaning of section 10. If the Program as you 378 | received it, or any part of it, contains a notice stating that it is 379 | governed by this License along with a term that is a further 380 | restriction, you may remove that term. If a license document contains 381 | a further restriction but permits relicensing or conveying under this 382 | License, you may add to a covered work material governed by the terms 383 | of that license document, provided that the further restriction does 384 | not survive such relicensing or conveying. 385 | 386 | If you add terms to a covered work in accord with this section, you 387 | must place, in the relevant source files, a statement of the 388 | additional terms that apply to those files, or a notice indicating 389 | where to find the applicable terms. 390 | 391 | Additional terms, permissive or non-permissive, may be stated in the 392 | form of a separately written license, or stated as exceptions; 393 | the above requirements apply either way. 394 | 395 | 8. Termination. 396 | 397 | You may not propagate or modify a covered work except as expressly 398 | provided under this License. Any attempt otherwise to propagate or 399 | modify it is void, and will automatically terminate your rights under 400 | this License (including any patent licenses granted under the third 401 | paragraph of section 11). 402 | 403 | However, if you cease all violation of this License, then your 404 | license from a particular copyright holder is reinstated (a) 405 | provisionally, unless and until the copyright holder explicitly and 406 | finally terminates your license, and (b) permanently, if the copyright 407 | holder fails to notify you of the violation by some reasonable means 408 | prior to 60 days after the cessation. 409 | 410 | Moreover, your license from a particular copyright holder is 411 | reinstated permanently if the copyright holder notifies you of the 412 | violation by some reasonable means, this is the first time you have 413 | received notice of violation of this License (for any work) from that 414 | copyright holder, and you cure the violation prior to 30 days after 415 | your receipt of the notice. 416 | 417 | Termination of your rights under this section does not terminate the 418 | licenses of parties who have received copies or rights from you under 419 | this License. If your rights have been terminated and not permanently 420 | reinstated, you do not qualify to receive new licenses for the same 421 | material under section 10. 422 | 423 | 9. Acceptance Not Required for Having Copies. 424 | 425 | You are not required to accept this License in order to receive or 426 | run a copy of the Program. Ancillary propagation of a covered work 427 | occurring solely as a consequence of using peer-to-peer transmission 428 | to receive a copy likewise does not require acceptance. However, 429 | nothing other than this License grants you permission to propagate or 430 | modify any covered work. These actions infringe copyright if you do 431 | not accept this License. Therefore, by modifying or propagating a 432 | covered work, you indicate your acceptance of this License to do so. 433 | 434 | 10. Automatic Licensing of Downstream Recipients. 435 | 436 | Each time you convey a covered work, the recipient automatically 437 | receives a license from the original licensors, to run, modify and 438 | propagate that work, subject to this License. You are not responsible 439 | for enforcing compliance by third parties with this License. 440 | 441 | An "entity transaction" is a transaction transferring control of an 442 | organization, or substantially all assets of one, or subdividing an 443 | organization, or merging organizations. If propagation of a covered 444 | work results from an entity transaction, each party to that 445 | transaction who receives a copy of the work also receives whatever 446 | licenses to the work the party's predecessor in interest had or could 447 | give under the previous paragraph, plus a right to possession of the 448 | Corresponding Source of the work from the predecessor in interest, if 449 | the predecessor has it or can get it with reasonable efforts. 450 | 451 | You may not impose any further restrictions on the exercise of the 452 | rights granted or affirmed under this License. For example, you may 453 | not impose a license fee, royalty, or other charge for exercise of 454 | rights granted under this License, and you may not initiate litigation 455 | (including a cross-claim or counterclaim in a lawsuit) alleging that 456 | any patent claim is infringed by making, using, selling, offering for 457 | sale, or importing the Program or any portion of it. 458 | 459 | 11. Patents. 460 | 461 | A "contributor" is a copyright holder who authorizes use under this 462 | License of the Program or a work on which the Program is based. The 463 | work thus licensed is called the contributor's "contributor version". 464 | 465 | A contributor's "essential patent claims" are all patent claims 466 | owned or controlled by the contributor, whether already acquired or 467 | hereafter acquired, that would be infringed by some manner, permitted 468 | by this License, of making, using, or selling its contributor version, 469 | but do not include claims that would be infringed only as a 470 | consequence of further modification of the contributor version. For 471 | purposes of this definition, "control" includes the right to grant 472 | patent sublicenses in a manner consistent with the requirements of 473 | this License. 474 | 475 | Each contributor grants you a non-exclusive, worldwide, royalty-free 476 | patent license under the contributor's essential patent claims, to 477 | make, use, sell, offer for sale, import and otherwise run, modify and 478 | propagate the contents of its contributor version. 479 | 480 | In the following three paragraphs, a "patent license" is any express 481 | agreement or commitment, however denominated, not to enforce a patent 482 | (such as an express permission to practice a patent or covenant not to 483 | sue for patent infringement). To "grant" such a patent license to a 484 | party means to make such an agreement or commitment not to enforce a 485 | patent against the party. 486 | 487 | If you convey a covered work, knowingly relying on a patent license, 488 | and the Corresponding Source of the work is not available for anyone 489 | to copy, free of charge and under the terms of this License, through a 490 | publicly available network server or other readily accessible means, 491 | then you must either (1) cause the Corresponding Source to be so 492 | available, or (2) arrange to deprive yourself of the benefit of the 493 | patent license for this particular work, or (3) arrange, in a manner 494 | consistent with the requirements of this License, to extend the patent 495 | license to downstream recipients. "Knowingly relying" means you have 496 | actual knowledge that, but for the patent license, your conveying the 497 | covered work in a country, or your recipient's use of the covered work 498 | in a country, would infringe one or more identifiable patents in that 499 | country that you have reason to believe are valid. 500 | 501 | If, pursuant to or in connection with a single transaction or 502 | arrangement, you convey, or propagate by procuring conveyance of, a 503 | covered work, and grant a patent license to some of the parties 504 | receiving the covered work authorizing them to use, propagate, modify 505 | or convey a specific copy of the covered work, then the patent license 506 | you grant is automatically extended to all recipients of the covered 507 | work and works based on it. 508 | 509 | A patent license is "discriminatory" if it does not include within 510 | the scope of its coverage, prohibits the exercise of, or is 511 | conditioned on the non-exercise of one or more of the rights that are 512 | specifically granted under this License. You may not convey a covered 513 | work if you are a party to an arrangement with a third party that is 514 | in the business of distributing software, under which you make payment 515 | to the third party based on the extent of your activity of conveying 516 | the work, and under which the third party grants, to any of the 517 | parties who would receive the covered work from you, a discriminatory 518 | patent license (a) in connection with copies of the covered work 519 | conveyed by you (or copies made from those copies), or (b) primarily 520 | for and in connection with specific products or compilations that 521 | contain the covered work, unless you entered into that arrangement, 522 | or that patent license was granted, prior to 28 March 2007. 523 | 524 | Nothing in this License shall be construed as excluding or limiting 525 | any implied license or other defenses to infringement that may 526 | otherwise be available to you under applicable patent law. 527 | 528 | 12. No Surrender of Others' Freedom. 529 | 530 | If conditions are imposed on you (whether by court order, agreement or 531 | otherwise) that contradict the conditions of this License, they do not 532 | excuse you from the conditions of this License. If you cannot convey a 533 | covered work so as to satisfy simultaneously your obligations under this 534 | License and any other pertinent obligations, then as a consequence you may 535 | not convey it at all. For example, if you agree to terms that obligate you 536 | to collect a royalty for further conveying from those to whom you convey 537 | the Program, the only way you could satisfy both those terms and this 538 | License would be to refrain entirely from conveying the Program. 539 | 540 | 13. Remote Network Interaction; Use with the GNU General Public License. 541 | 542 | Notwithstanding any other provision of this License, if you modify the 543 | Program, your modified version must prominently offer all users 544 | interacting with it remotely through a computer network (if your version 545 | supports such interaction) an opportunity to receive the Corresponding 546 | Source of your version by providing access to the Corresponding Source 547 | from a network server at no charge, through some standard or customary 548 | means of facilitating copying of software. This Corresponding Source 549 | shall include the Corresponding Source for any work covered by version 3 550 | of the GNU General Public License that is incorporated pursuant to the 551 | following paragraph. 552 | 553 | Notwithstanding any other provision of this License, you have 554 | permission to link or combine any covered work with a work licensed 555 | under version 3 of the GNU General Public License into a single 556 | combined work, and to convey the resulting work. The terms of this 557 | License will continue to apply to the part which is the covered work, 558 | but the work with which it is combined will remain governed by version 559 | 3 of the GNU General Public License. 560 | 561 | 14. Revised Versions of this License. 562 | 563 | The Free Software Foundation may publish revised and/or new versions of 564 | the GNU Affero General Public License from time to time. Such new versions 565 | will be similar in spirit to the present version, but may differ in detail to 566 | address new problems or concerns. 567 | 568 | Each version is given a distinguishing version number. If the 569 | Program specifies that a certain numbered version of the GNU Affero General 570 | Public License "or any later version" applies to it, you have the 571 | option of following the terms and conditions either of that numbered 572 | version or of any later version published by the Free Software 573 | Foundation. If the Program does not specify a version number of the 574 | GNU Affero General Public License, you may choose any version ever published 575 | by the Free Software Foundation. 576 | 577 | If the Program specifies that a proxy can decide which future 578 | versions of the GNU Affero General Public License can be used, that proxy's 579 | public statement of acceptance of a version permanently authorizes you 580 | to choose that version for the Program. 581 | 582 | Later license versions may give you additional or different 583 | permissions. However, no additional obligations are imposed on any 584 | author or copyright holder as a result of your choosing to follow a 585 | later version. 586 | 587 | 15. Disclaimer of Warranty. 588 | 589 | THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY 590 | APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT 591 | HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY 592 | OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, 593 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 594 | PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM 595 | IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF 596 | ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 597 | 598 | 16. Limitation of Liability. 599 | 600 | IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING 601 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS 602 | THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY 603 | GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE 604 | USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF 605 | DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD 606 | PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), 607 | EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF 608 | SUCH DAMAGES. 609 | 610 | 17. Interpretation of Sections 15 and 16. 611 | 612 | If the disclaimer of warranty and limitation of liability provided 613 | above cannot be given local legal effect according to their terms, 614 | reviewing courts shall apply local law that most closely approximates 615 | an absolute waiver of all civil liability in connection with the 616 | Program, unless a warranty or assumption of liability accompanies a 617 | copy of the Program in return for a fee. 618 | 619 | END OF TERMS AND CONDITIONS 620 | 621 | How to Apply These Terms to Your New Programs 622 | 623 | If you develop a new program, and you want it to be of the greatest 624 | possible use to the public, the best way to achieve this is to make it 625 | free software which everyone can redistribute and change under these terms. 626 | 627 | To do so, attach the following notices to the program. It is safest 628 | to attach them to the start of each source file to most effectively 629 | state the exclusion of warranty; and each file should have at least 630 | the "copyright" line and a pointer to where the full notice is found. 631 | 632 | 633 | Copyright (C) 634 | 635 | This program is free software: you can redistribute it and/or modify 636 | it under the terms of the GNU Affero General Public License as published 637 | by the Free Software Foundation, either version 3 of the License, or 638 | (at your option) any later version. 639 | 640 | This program is distributed in the hope that it will be useful, 641 | but WITHOUT ANY WARRANTY; without even the implied warranty of 642 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 643 | GNU Affero General Public License for more details. 644 | 645 | You should have received a copy of the GNU Affero General Public License 646 | along with this program. If not, see . 647 | 648 | Also add information on how to contact you by electronic and paper mail. 649 | 650 | If your software can interact with users remotely through a computer 651 | network, you should also make sure that it provides a way for users to 652 | get its source. For example, if your program is a web application, its 653 | interface could display a "Source" link that leads users to an archive 654 | of the code. There are many ways you could offer source, and different 655 | solutions will be better for different programs; see section 13 for the 656 | specific requirements. 657 | 658 | You should also get your employer (if you work as a programmer) or school, 659 | if any, to sign a "copyright disclaimer" for the program, if necessary. 660 | For more information on this, and how to apply and follow the GNU AGPL, see 661 | . 662 | --------------------------------------------------------------------------------