Skip to content

Instantly share code, notes, and snippets.

View sozysozbot's full-sized avatar

sozysozbot / hsjoihs sozysozbot

View GitHub Profile
#[test]
fn test_eat_primary() {
assert_eq!(eat_primary("3+5"), (3, "+5"));
assert_eq!(eat_primary("8-5*4+3"), (8, "-5*4+3"));
}
// 先頭から数字を一個食って、「食った数字と食い残した文字列」を返す
fn eat_primary(s: &str) -> (i32, &str) {
if s.starts_with('0') { return (0, &s[1..]); }
if s.starts_with('1') { return (1, &s[1..]); }
@sozysozbot
sozysozbot / festvox_on_ubuntu.sh
Created June 5, 2022 02:38
Since it took me quite some time to set up FestVox on Ubuntu on WSL2, I decided to summarize what works
# I tested this in a cleanly installed Ubuntu on WSL2
sudo apt-get upgrade
sudo apt-get update
sudo apt-get install build-essential
sudo apt-get install libncurses5-dev libncursesw5-dev
# Edinburgh Speech Tools 2.5
# The folder name MUST be speech_tools/
curl http://festvox.org/packed/festival/2.5/speech_tools-2.5.0-release.tar.gz -o speech_tools.tar.gz
tar -xvf speech_tools.tar.gz
(**
以下、日本標準時 (UTC+9:00) においては西暦2020年12月30日に行われた会話である
hsjoihs 16:29
おっ。とりあえず私はOpeLaの構文論を形式化しようとしています
uchan_nos 16:29
そんなことを!?w
@sozysozbot
sozysozbot / NullPointerException
Last active June 1, 2019 01:54
ZpDIC ver 1.34.0-2591をWindows 10上 (openjdk 11.0.3 2019-04-16, JavaFX 11.0.2)で動かし、登録済み辞書を開こうとした際に「辞書が壊れている可能性があります。」とともに出たログ。直後にもう一度やるが再現せず。
java.lang.NullPointerException
at javafx.base/javafx.collections.transformation.SortedList$Element.access$200(SortedList.java:277)
at javafx.base/javafx.collections.transformation.SortedList$ElementComparator.compare(SortedList.java:299)
at javafx.base/javafx.collections.transformation.SortedList$ElementComparator.compare(SortedList.java:288)
at javafx.base/com.sun.javafx.collections.SortHelper.mergeSort(SortHelper.java:260)
at javafx.base/com.sun.javafx.collections.SortHelper.mergeSort(SortHelper.java:272)
at javafx.base/com.sun.javafx.collections.SortHelper.mergeSort(SortHelper.java:271)
at javafx.base/com.sun.javafx.collections.SortHelper.mergeSort(SortHelper.java:271)
at javafx.base/com.sun.javafx.collections.SortHelper.mergeSort(SortHelper.java:271)
at javafx.base/com.sun.javafx.collections.SortHelper.mergeSort(SortHelper.java:272)
CommonIO.hs:20: putStrLn' English $ NormalMessage $ "\nparsing " ++ filepath ++ ":\n"
Execute.hs:64: then runtimeError $ "f5 register was not preserved after the call. It should be in " ++ show initialF5 ++ " but is actually in " ++ show a
Execute.hs:276: Nothing -> runtimeError $ "Undefined label `" ++ unLabel label ++ "`"
Execute.hs:276: Nothing -> runtimeError $ "Undefined label `" ++ unLabel label ++ "`"
Execute.hs:309: | otherwise -> runtimeError $ "nx has an invalid address " ++ show currentNX
Linker.hs:23: Left _ -> Left $ LinkError "multiple files lack `kue`"
Linker.hs:25: Nothing -> Left $ LinkError "all files have `kue`"
Linker.hs:37: "conflict: different files export the same label(s) `" ++ intercalate ", " (map unLabel labels) ++ "“"
Linker.hs:45-46: "conflict: cannot import label(s) `" ++ intercalate ", " (map unLabel xokConflicts) ++ "` that is already defined in the file"
Linker.hs:50-51: "cannot export label(s) `" ++ intercalate ", " (map unLabel kueWithoutEvidence) ++ "` that
~stususn =0.809263;
(
SynthDef("kin2lia1", {
arg note=0, amp=1;
var a = (note+61.478).midicps;
var duration = 2.5*~stususn;
var factor = 0.8;
var divisor = 1.0+factor+(factor*factor)+(factor*factor*factor)+(factor*factor*factor*factor);
var snd = LPF.ar(
function counting(arr){
var obj={};
for(var i=0;i<arr.length;i++){
obj[arr[i][0]] = obj[arr[i][0]] ? (obj[arr[i][0]]+arr[i][1]) : arr[i][1];
}
return obj;
}
var dat2 = dat.map(a=>a[1]).map(a => [].concat.apply([],a).map(b=>[b,1/a.length]))
var dat3 = [].concat.apply([],dat2);
console.log(JSON.stringify(counting(dat3)));
["-'c","-'c","-'c","-'c","-'c","-'c","-'c","-'c","-'c","-'c","-'c","-'c","-'c","-'c","-'c","-'c","-'c","-'c","-'c","-'c","-'c","-'c","-'c","-'c","-'c","-'c","-'c","-'c","-'c","-'c","-'c","-'c","-'c","-'c","-'c","-'c","-'c","-'c","-'c","-'c","-'c","-'c","-'c","-'c","-'c","-'c","-'c","-'c","-'c","-'c","-'c","-'c","-'c","-'c","-'c","-'c","-'c","-'c","-'c","-'c","-'c","-'c","-'c","-'c","-'c","-'c","-'c","-'c","-'c","-'c","-'c","-'c","-'c","-'c","-'c","-'c","-'c","-'c","-'c","-'c","-'c","-'c","-'c","-'c","-'c","-'c","-'c","-'c","-'c","-'c","-'c","-'c","-'c","-'c","-'c","-'d","-'d","-'d","-'d","-'d","-'d","-'d","-'d","-'d","-'d","-'d","-'d","-'d","-'d","-'d","-'d","-'d","-'d","-'d","-'d","-'d","-'d","-'d","-'d","-'d","-'d","-'d","-'d","-'d","-'d","-'d","-'d","-'d","-'d","-'d","-'d","-'d","-'d","-'d","-'d","-'d","-'d","-'d","-'d","-'d","-'d","-'d","-'d","-'d","-'d","-'d","-'d","-'d","-'d","-'d","-'d","-'d","-'d","-'d","-'d","-'d","-'d","-'d","-'d","-'d","-'d","-'d","-'d","-'d","-'d","-'d","-'d","-'d","-'d","-'d","-'
"-adlis",
"-afa",
"-afi'a",
"-afis",
"-ain",
"-al",
"-an",
"-anfy",
"-axm",
"-back",