Skip to content

Instantly share code, notes, and snippets.

View arademaker's full-sized avatar
🎯
Focusing

Alexandre Rademaker arademaker

🎯
Focusing
View GitHub Profile
(defun normalize-agents ()
(labels ((compare-agents (agent1 agent2)
(let ((u1 (nth 0 agent1))
(u2 (nth 0 agent2)))
(if (upi= u1 u2)
(list u1 u2 0)
(list u1 u2
(loop for i in (cdr agent1)
for j in (cdr agent2)
summing (numeric-upi-equal i j) into total
(ql:quickload :drakma)
(ql:quickload :st-json)
(defun show-google-hits (term key ck)
(let* ((query (list (cons "key" key)
(cons "cx" ck)
(cons "q" term)))
(stream (drakma:http-request "https://www.googleapis.com/customsearch/v1"
:parameters query
@arademaker
arademaker / reading-stream.lisp
Last active August 29, 2015 14:02
CL example of reading a stream...
(let ((data (make-array 20 :initial-element nil)))
(values(read-sequence data (make-string-input-stream "testing things")) data))
@arademaker
arademaker / stable-matching.R
Last active August 29, 2015 14:03
code of stable matching problem in R
# Solucao baseada no pseudo-codigo apresentado em:
# http://en.wikipedia.org/wiki/Stable_marriage_problem
stable.match <- function(hprefs, mprefs, debug=FALSE){
proposed <- matrix(rep(FALSE,25), ncol = 5, dimnames = list(Homens = 1:5, Mulheres = 1:5))
alloc <- matrix(rep(FALSE,25), ncol = 5, dimnames = list(Homens = 1:5, Mulheres = 1:5))
# os nomes das linhas e colunas irao ser usados para indicar os
# indices para selecao de elementos das matrizes proposed e alloc,
# por isso precisam ser renomeados.
@arademaker
arademaker / fibonacci.lisp
Last active August 29, 2015 14:03
Fibonacci functions in CL. Used in the presentation of Chapter 0 of http://books.google.com/books?id=3sCxQgAACAAJ
(defun fib1 (n)
(cond
((equal n 0) 0)
((equal n 1) 1)
(t (+ (fib1 (- n 1))
(fib1 (- n 2))))))
(defun fib2 (n)
(labels ((calc-fib (n a b)
@arademaker
arademaker / linked-lists.lisp
Last active August 29, 2015 14:03
linked lists and vectors
; first version: procedural
(defun nth-1 (n alist)
(let ((current alist))
(dotimes (v n current)
(if (equal v n)
(car current)
(setf current (cdr current))))))
; second version: functional
@arademaker
arademaker / exemplos.hs
Created July 28, 2014 14:48
first example in Haskell
-- testing double without type information
double x = x + x
-- testing the first example
qsort :: Ord a => [a] -> [a]
qsort [] = []
qsort (p:xs) = (qsort lesser) ++ [p] ++ (qsort greater)
where
lesser = filter (< p) xs
greater = filter (>= p) xs
@arademaker
arademaker / harem.dtd
Created November 3, 2014 15:17
DTD from the Golden Collection of the Second HAREM (http://www.linguateca.pt/harem/)
<?xml version="1.0" encoding="ISO-8859-1"?>
<!ELEMENT EM (#PCDATA) >
<!ATTLIST EM
ID CDATA #REQUIRED
CATEG CDATA #IMPLIED
TIPO CDATA #IMPLIED
COMENT CDATA #IMPLIED
SUBTIPO CDATA #IMPLIED >
@arademaker
arademaker / chickens.lisp
Last active August 29, 2015 14:14
chickens
;; utilities
(defun combinations (&rest lists)
(if (car lists)
(mapcan (lambda (inner-val)
(mapcar (lambda (outer-val)
(cons outer-val inner-val))
(car lists)))
(apply #'combinations (cdr lists)))
(list nil)))

Portuguese POS tagged corpora

Dados CoNLL-X

Este primeiro arquivo foi obtido do CoNLL-X Shared Task. É o arquivo de teste disponibilizado. A quarta coluna, V4, contém a tag.