Skip to content

Instantly share code, notes, and snippets.

View arademaker's full-sized avatar
🎯
Focusing

Alexandre Rademaker arademaker

🎯
Focusing
View GitHub Profile
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)))
(ql:quickload :snark)
(initialize)
(use-resolution t)
(defun var-complemente (var)
(if (equal var '?x)
'?y
'?x))
(setenv "LANG" "en_US.UTF-8")
(setenv "LC_ALL" "en_US.UTF-8")
(prefer-coding-system 'utf-8)
(set-language-environment "UTF-8")
;; slime setup
(use-package slime
:init
(load (expand-file-name "~/quicklisp/slime-helper.el"))
:config
RACER-USER> (signature :atomic-concepts (A C a1 a2)
:roles (h))
; No value
RACER-USER> (equivalent a1 (and (some h A) (all h C)))
A1
RACER-USER> (equivalent a2 (some h C))
A2
RACER-USER> (concept-subsumes? a1 a2)
NIL
RACER-USER> (concept-subsumes? a2 a1)
(defmacro with-open-files (args &rest body)
(let ((res `(progn ,@body)))
(reduce (lambda (acc e) `(with-open-file (,@e) ,acc)) args
:initial-value res)))
(defmacro with-open-files-1 (args &rest body)
(let ((res `(progn ,@body)))
(dolist (a (reverse args) res)
(setf res `(with-open-file (,@a)
,res)))))