Skip to content

Instantly share code, notes, and snippets.

View arademaker's full-sized avatar
🎯
Focusing

Alexandre Rademaker arademaker

🎯
Focusing
View GitHub Profile
% pipx install mathlibtools
ERROR: Command errored out with exit status 1:
command: /Users/ar/.local/pipx/venvs/mathlibtools/bin/python -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/_t/t93k_3n17s916hfg0nb0hfb40000gn/T/pip-install-4zs2ysbb/pyyaml_c2e9947ee533476b87f4aeaa1aec081e/setup.py'"'"'; __file__='"'"'/private/var/folders/_t/t93k_3n17s916hfg0nb0hfb40000gn/T/pip-install-4zs2ysbb/pyyaml_c2e9947ee533476b87f4aeaa1aec081e/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' bdist_wheel -d /private/var/folders/_t/t93k_3n17s916hfg0nb0hfb40000gn/T/pip-wheel-6kj_k65w
cwd: /private/var/folders/_t/t93k_3n17s916hfg0nb0hfb40000gn/T/pip-install-4zs2ysbb/pyyaml_c2e9947ee533476b87f4aeaa1aec081e/
Complete output (67 lines):
running bdist_wheel
running build
running build_py
creating build
creating build/lib.macosx-11-x86_64-3.9
@arademaker
arademaker / Merge.hs
Created October 31, 2020 20:59
Merge.hs
{-# LANGUAGE DeriveGeneric, OverloadedStrings #-}
import qualified Data.ByteString.Lazy as B
import Data.List
import System.FilePath.Posix
import System.IO
import System.Environment
import Data.Aeson
import Data.Text
import GHC.Generics
@arademaker
arademaker / merge.hs
Last active August 10, 2020 23:02
merge two files
import Data.List
import System.FilePath.Posix
-- read the files into a list of strings (assuming they are an ordered list of pathnames)
-- convert the list of pathnames into a list of objs
-- merge the list of objs
-- produce the output
-- or http://hackage.haskell.org/package/multiset-0.2.2/docs/Data-MultiSet.html
line1 = "ontonotes-release-5.0/data/files/data/english/annotations/bc/cctv/00/cctv_0000.parse"
-- Excerpt From: Graham Hutton. “Programming in Haskell.”
import Data.Char
positions :: Eq a => a -> [a] -> [Int]
positions x xs = [i | (x',i) <- zip xs [0..], x == x']
lowers :: String -> Int
lowers xs = length [x | x <- xs, x >= 'a' && x <= 'z']
ar@leme udp % awk '$3 ~ /^(irmã|irmão|pai|mãe|tio|tia|bisavô|bisavó|primo|prima|avô|avó|sobrinho|sobrinha|cunhado|cunhada|parente)$/ {print $2,$3}' *.conllu | sort | uniq -c | sort -nr
1622 pai pai
1283 irmão irmão
336 tio tio
336 irmãos irmão
315 Sobrinho sobrinho
277 avô avô
272 primo primo
256 mãe mãe
188 sobrinho sobrinho
ar@leme workspace % echo $SIGMA_CP
/Users/ar/workspace/sigmakee/build/classes:/Users/ar/workspace/sigmakee/build/lib/*:/Users/ar/workspace/sigmakee/lib/*
ar@leme workspace % java -Xmx7g -classpath $SIGMA_CP com.articulate.sigma.InferenceTestSuite -t SP01.kif.tq
Info in KBmanager.initializeOnce()
Info in KBmanager.initializeOnce(): initializing with /Users/ar/.sigmakee/KBs
KBmanager.readConfiguration()
KBmanager.serializedExists(): true
KBmanager.serializedOld(config):
KBmanager.serializedOld(config): save date: Thu May 28 01:48:33 BRT 2020
@arademaker
arademaker / powerset.lean
Created October 15, 2019 13:29
powerset in lean
open set
variable {U : Type}
example (A B : set U) : A ∈ powerset (A ∪ B) :=
assume x,
assume : x ∈ A,
show x ∈ A ∪ B, from or.inl ‹x ∈ A›
@arademaker
arademaker / rdf-to-json.lisp
Created November 28, 2018 02:12
Wilbur vs RDFLib
(ql:quickload '(:yason :wilbur :alexandria) :silent t)
(wilbur:add-namespace "du" "http://br.ibm.com/document-understanding/")
(defun get-relations (sent)
(let ((rels (wilbur:all-values sent '!du:hasRelation)))
(mapcar (lambda (rel)
(alexandria:plist-hash-table
(list "origin" (wilbur:value rel '(:seq !du:origin))
"subject" (wilbur:value rel '(:seq !du:subject))
@arademaker
arademaker / rdf-to-json.py
Created November 28, 2018 02:11
Wilbur vs rdflib
import sys
import jsonlines
import rdflib
from rdflib.namespace import RDFS, SKOS, RDF
from rdflib import Namespace
import json
ont = sys.argv[1]
(ql:quickload :cxml)
(ql:quickload :cxml-stp)
(defparameter *document* (cxml:parse #P"raw/2010-official-1.xml"
(stp:make-builder)))
(let (res)
(xpath:do-node-set (node (xpath:evaluate "//statement" *document*) res)
(push (xpath-protocol:node-text node) res)))