Skip to content

Instantly share code, notes, and snippets.

@7shi
7shi / ssml_nov.py
Last active May 22, 2020
[py] SSML converter for Novial
View ssml_nov.py
# CC0 http://creativecommons.org/publicdomain/zero/1.0/
import getopt, re, sys
lang = "sk-SK" # ca-ES, cs-CZ, de-CH, de-DE, hr-HR, hu-HU, pl-PL, ro-RO, ru-RU, sk-SK, sl-SI
testwords = [] #"nusen patre intestines familie lause".split()
phonemes = {}
def setphonemes(phs):
@7shi
7shi / ssml_ile.py
Last active May 19, 2020
[py] SSML converter for Interlingue/Occidental
View ssml_ile.py
# CC0 http://creativecommons.org/publicdomain/zero/1.0/
import getopt, re, sys
lang = "ro-RO" # ca-ES, pl-PL, ro-RO, sk-SK, sl-SI
testwords = [] #"intercalar forme familie rapidmen duplic café ínpossibil".split()
phonemes = {}
def setphonemes(phs):
@7shi
7shi / ssml_epo.py
Created May 15, 2020
[py] SSML converter for Esperanto
View ssml_epo.py
# CC0 http://creativecommons.org/publicdomain/zero/1.0/
phonemes = {}
def setphonemes(phs):
for ph in phs.split():
p1, p2 = ph.split(",")
phonemes[p1] = p2
setphonemes("a,A b,B c,TS ĉ,CH d,D e,E f,F g,G ĝ,JH h,H")
@7shi
7shi / Makefile
Created May 15, 2020
[py][F#] Esperanta Alfabeto
View Makefile
TARGET = alfabeto
MKWAV = ~/bin/wintts -o $$wav `python ssml_lfn.py -l pl-PL -f $$txt`
SILENT = ffmpeg -t 00:00:02 -f s16le -i /dev/zero -acodec pcm_s16le -ar 22050 -ac 1 $$wav
MKAVI = ffmpeg -loop 1 -i $$png -i $$wav -vcodec mpeg4 -acodec pcm_s16le -shortest $$avi
all: $(TARGET).mp4
clean:
rm -f $(TARGET).mp4 $(TARGET).lst *.avi *.png *.wav
@7shi
7shi / Makefile
Last active May 13, 2020
[F#][make] 読み上げ動画の生成
View Makefile
TARGET = foo
MKWAV = ~/bin/wintts -o $$wav `python ssml_lfn.py -l pl-PL -f $$txt`
SILENT = ffmpeg -t 00:00:02 -f s16le -i /dev/zero -acodec pcm_s16le -ar 22050 -ac 1 $$wav
MKAVI = ffmpeg -loop 1 -i $$png -i $$wav -vcodec mpeg4 -acodec pcm_s16le -shortest $$avi
all: $(TARGET).mp4
clean:
rm -f $(TARGET).mp4 $(TARGET).lst $(TARGET)-*.avi $(TARGET)-*.wav $(TARGET)-*.png $(TARGET)-*.txt
@7shi
7shi / ssml_lfn.py
Last active May 19, 2020
[py] SSML converter for Lingua Franca Nova
View ssml_lfn.py
# CC0 http://creativecommons.org/publicdomain/zero/1.0/
import getopt, sys
options = "l:f:"
def usage():
print("usage: %s -l lang (-f file | text ...)" % sys.argv[0])
exit(1)
_phons = {}
@7shi
7shi / calc.py
Created May 10, 2020
[py] Levenshtein distance of conlangs' Swadesh list
View calc.py
# pip install python-levenshtein
import itertools, Levenshtein
with open("swadesh.csv") as f:
data = [line.split(",") for line in f.readlines()]
slang = "English|Esperanto|Ido|Novial|Interlingue|Interlingua"
langs = slang.split("|")
count = len(langs)
split = "|----|%s|" % "|".join(["---:"] * count)
@7shi
7shi / Convert.fsx
Last active May 10, 2020
[F#] Novial dictionary converter
View Convert.fsx
// https://sites.google.com/site/noviallexike/novial-lexike-1930
// https://gist.github.com/7shi/de072cd867f3899aa285bc9343110bff
#load "XmlParser.fsx"
open System.IO
open XmlParser
do
use xp = new XmlParser(new StreamReader("novial.html"))
@7shi
7shi / convert.py
Last active May 10, 2020
[py] Novial dictionary converter (OBSOLETE!)
View convert.py
# extract tgz from http://www.blahedo.org/novial/nl.html
with open("novial.txt", "w", encoding="utf-8") as novial:
for i in range(ord("A"), ord("Z")):
with open("%c.txt" % i, encoding="iso-8859-1") as f:
lines = f.readlines()
texts = []
for i, line in enumerate(lines):
line = line.strip()
if i > 1 and not line:
if texts:
@7shi
7shi / Convert.fsx
Created May 8, 2020
[F#] Volapük dictionary converter
View Convert.fsx
// http://personal.southern.edu/~caviness/Volapuk/Misc/eng-vol.htm
// http://personal.southern.edu/~caviness/Volapuk/Misc/vol-eng.htm
// https://gist.github.com/7shi/de072cd867f3899aa285bc9343110bff
#load "XmlParser.fsx"
open System
open System.IO
open System.Text
open XmlParser