<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0">
  <channel>
    <title>O-Auto-Falante</title>
    <link>http://www.diale.org/w3log/08.mar.html</link>
    <description>W3log de Tiago Charters de Azevedo (Comentários para: tca@diale.org)</description>
    <language>en-us</language>
    <generator>Emacs Muse</generator>

<item>
<title> Aspectos computacionais das linguagens naturais</title>
<link>http://www.diale.org/w3log/08.mar.html#%20Aspectos%20computacionais%20das%20linguagens%20naturais</link>
<description><![CDATA[
<p>Tenho há já algum tempo andado a estudar alguns aspectos computacionais das
linguagens naturais.</p>

<p>A primeira abordagem foi a construção do <a href="http://www.diale.org/w3log/08.mar.html#Algumas%20fun%8E7%8F5es%20em%20Lisp%20para%20o%20algoritmo%20de%20Porter">algoritmo de Porter</a> para Português, no
entanto deparado com a <a href="http://snowball.tartarus.org/algorithms/portuguese/stemmer.html">versão mais antiga</a> e a <a href="http://www.inf.ufrgs.br/~vmorengo/rslp/">versão mais &quot;rigorosa&quot;</a> fiquei com
a dúvida, que ainda persiste, se a última não poderá ainda ser melhorada. Isto
é, usando um dicionário mais completo, aquele que tenho contém meio milhão de
palavras, e usando um número menor de excepções.</p>

<p>No entanto o algoritmo de Porter para português em Emacs Lisp ficou pelo caminho.
Encontrei o SNOBOL, o que teve  como consequência imediata a reescrita quase total do
código original em termos de funções em Lisp que implementam as instruções em
SNOBOL. O prazo que impus a mim mesmo para acabar o código
acabou e fiquei apenas com um
<a href="http://www.diale.org/w3log/08.mar.html#Algumas%20fun%8E7%8F5es%20em%20Lisp%20para%20o%20algoritmo%20de%20Porter">punhado de funções em Lisp que implementa apenas parte do algoritmo</a>.</p>

<p>Depois disso uma pesquisa levou-me a <a href="http://www.chomsky.info">Noam Chomsky</a> e primeiro ao <a href="http://mitpress.mit.edu/book-home.tcl?isbn=0262531283">The Minimalist Program</a>
e depois ao <a href="http://en.wikipedia.org/wiki/Syntactic_Structures">Syntactic Structures</a>.
Deste último partilho da opinião do <a href="http://www-cs-faculty.stanford.edu/~knuth/">Donald Knuth</a>
<blockquote>
<p class="quoted">&quot;...researchers in linguistics were beginning to formulate rules of grammar
that were considerably more mathematical than before. And people began to
realize that such methods are highly relevant to the artificial languages that
were becoming popular for computer programming, even though natural languages
like English remained intractable. I found the mathematical approach to
grammar immediately appealing...&quot;</p>
</blockquote>

<p>O que ficou, e está ainda aqui dentro a ressoar, é a pergunta: como relacionar a
determinação dos sufixos, usando o algoritmo de Porter, já que estes determinam
os tempos verbais, plural, etc, das palavras, e as regras de transformação de
que fala Chomsky? Como construir as formas computacionais, leia-se gramática
universal, tendo apenas como base, os sufixos e o que eles determinam, e a
estrutura sintáctica?</p>

<p>Talvez a resposta passe pelos <a href="http://worrydream.com/AlligatorEggs/">crocodilos (palavras) e os seus ovos (sufixos)</a>?!</p>

<p class="image"><img src="http://worrydream.com/AlligatorEggs/gameplay_1.png" alt=""></p>

]]></description>
<author>Tiago Charters de Azevedo</author>
<pubDate>Mon, 31 Mar 2008 00:00:00 WEST</pubDate>
<guid>http://www.diale.org/w3log/08.mar.html#%20Aspectos%20computacionais%20das%20linguagens%20naturais</guid>

</item>

<item>
<title>The fundamental aim in the linguistic analysis </title>
<link>http://www.diale.org/w3log/08.mar.html#The%20fundamental%20aim%20in%20the%20linguistic%20analysis%20</link>
<description><![CDATA[
<img src="./img/rot.t.small.png" alt="">

<blockquote>
<p class="quoted">The fundamental aim in the linguistic analysis of a language L is to separate
the grammatical sequences which are the sentences of L from the ungrammatical
sequences which are note sentences of L. The grammar of L will thus be a
device that generates all of the grammatical sequences of L and none of the
ungrammatical ones.</p>
</blockquote>

<p>Noam Chomsky,  Syntactic Structures, 2nd ed., Mouton (2002)</p>

]]></description>
<author>Tiago Charters de Azevedo</author>
<pubDate>Sun, 30 Mar 2008 00:00:00 WET</pubDate>
<guid>http://www.diale.org/w3log/08.mar.html#The%20fundamental%20aim%20in%20the%20linguistic%20analysis%20</guid>

</item>

<item>
<title>Pelo relógio</title>
<link>http://www.diale.org/w3log/08.mar.html#Pelo%20relógio</link>
<description><![CDATA[
<img src="./img/pelorelogio.jpg" alt="">

]]></description>
<author>Tiago Charters de Azevedo</author>
<pubDate>Sat, 29 Mar 2008 00:00:00 WET</pubDate>
<guid>http://www.diale.org/w3log/08.mar.html#Pelo%20relógio</guid>

</item>

<item>
<title>Alguns detalhes</title>
<link>http://www.diale.org/w3log/08.mar.html#Alguns%20detalhes</link>
<description><![CDATA[
<img src="./img/m2.jpg" alt="">

<p class="image"><img src="./img/m1.jpg" alt=""></p>

<p class="image"><img src="./img/m3.jpg" alt=""></p>

<p class="image"><img src="./img/m4.jpg" alt=""></p>

]]></description>
<author>Tiago Charters de Azevedo</author>
<pubDate>Sat, 29 Mar 2008 00:00:00 WET</pubDate>
<guid>http://www.diale.org/w3log/08.mar.html#Alguns%20detalhes</guid>

</item>

<item>
<title>Panorama</title>
<link>http://www.diale.org/w3log/08.mar.html#Panorama</link>
<description><![CDATA[
<img src="./img/p_geo.small.png" alt="">

]]></description>
<author>Tiago Charters de Azevedo</author>
<pubDate>Sat, 29 Mar 2008 00:00:00 WET</pubDate>
<guid>http://www.diale.org/w3log/08.mar.html#Panorama</guid>

</item>

<item>
<title> Mathematics and Industry Group</title>
<link>http://www.diale.org/w3log/08.mar.html#%20Mathematics%20and%20Industry%20Group</link>
<description><![CDATA[
<p>Novo grupo para discussão no Google Groups.</p>

<p class="image"><img src="./img/mig.logo.2.png" alt="">
<a href="http://groups.google.com/group/mathematics-and-industry-group">http://groups.google.com/group/mathematics-and-industry-group</a></p>

]]></description>
<author>Tiago Charters de Azevedo</author>
<pubDate>Fri, 28 Mar 2008 00:00:00 WET</pubDate>
<guid>http://www.diale.org/w3log/08.mar.html#%20Mathematics%20and%20Industry%20Group</guid>

</item>

<item>
<title>Veritatis via bona est</title>
<link>http://www.diale.org/w3log/08.mar.html#Veritatis%20via%20bona%20est</link>
<description><![CDATA[
<img src="./img/veritatis-via-bona-est.small.jpg" alt="">

]]></description>
<author>Tiago Charters de Azevedo</author>
<pubDate>Thu, 27 Mar 2008 00:00:00 WET</pubDate>
<guid>http://www.diale.org/w3log/08.mar.html#Veritatis%20via%20bona%20est</guid>

</item>

<item>
<title>Hacker book</title>
<link>http://www.diale.org/w3log/08.mar.html#Hacker%20book</link>
<description><![CDATA[
<p>Quem o terá lido em 1985?</p>

<p class="image"><img src="./img/zx.jpg" alt=""></p>

<p>Ref: <a href="http://catb.org/~esr/faqs/hacker-howto.html">http://catb.org/~esr/faqs/hacker-howto.html</a></p>

]]></description>
<author>Tiago Charters de Azevedo</author>
<pubDate>Wed, 26 Mar 2008 00:00:00 WET</pubDate>
<guid>http://www.diale.org/w3log/08.mar.html#Hacker%20book</guid>

</item>

<item>
<title>Simetrias: propositadas ou aparentes</title>
<link>http://www.diale.org/w3log/08.mar.html#Simetrias%3A%20propositadas%20ou%20aparentes</link>
<description><![CDATA[
<img src="./img/ec_faces_comp.small.png" alt="">

]]></description>
<author>Tiago Charters de Azevedo</author>
<pubDate>Sat, 22 Mar 2008 00:00:00 WET</pubDate>
<guid>http://www.diale.org/w3log/08.mar.html#Simetrias%3A%20propositadas%20ou%20aparentes</guid>

</item>

<item>
<title>Ecce Homo</title>
<link>http://www.diale.org/w3log/08.mar.html#Ecce%20Homo</link>
<description><![CDATA[
<img src="./img/ecce_homo.jpg" alt="">


<pre>
museu/instituição:	 	Museu Nacional de Arte Antiga
supercategoria:	 	 	Artes Plásticas e Artes Decorativas
categoria:	 	 	Pintura
denominação:	 	 	Ecce Homo
autor(es):	 	 	Mestre Desconhecido
datação:  	   	   	1570 d.C.
dimensões: 	  	  	altura: 89 largura: 65
</pre>


]]></description>
<author>Tiago Charters de Azevedo</author>
<pubDate>Fri, 21 Mar 2008 00:00:00 WET</pubDate>
<guid>http://www.diale.org/w3log/08.mar.html#Ecce%20Homo</guid>

</item>

<item>
<title>Avô, CT1NB</title>
<link>http://www.diale.org/w3log/08.mar.html#Avô%2C%20CT1NB</link>
<description><![CDATA[

<object width="425" height="355"><param name="movie" value="http://www.youtube.com/v/KfjUGif84lE&hl=en"></param><param name="wmode" value="transparent"></param><embed src="http://www.youtube.com/v/KfjUGif84lE&hl=en" type="application/x-shockwave-flash" wmode="transparent" width="425" height="355"></embed></object>

]]></description>
<author>Tiago Charters de Azevedo</author>
<pubDate>Thu, 20 Mar 2008 00:00:00 WET</pubDate>
<guid>http://www.diale.org/w3log/08.mar.html#Avô%2C%20CT1NB</guid>

</item>

<item>
<title>Engarrafamento</title>
<link>http://www.diale.org/w3log/08.mar.html#Engarrafamento</link>
<description><![CDATA[

<object width="425" height="355"><param name="movie" value="http://www.youtube.com/v/Suugn-p5C1M"></param><param name="wmode" value="transparent"></param><embed src="http://www.youtube.com/v/Suugn-p5C1M" type="application/x-shockwave-flash" wmode="transparent" width="425" height="355"></embed></object>


<p>Ref:
<a href="http://technology.newscientist.com/article/dn13402-shockwave-traffic-jam-recreated-for-first-time.html">Shockwave traffic jam recreated for first time: NewScientist.com news service</a></p>

]]></description>
<author>Tiago Charters de Azevedo</author>
<pubDate>Thu, 20 Mar 2008 00:00:00 WET</pubDate>
<guid>http://www.diale.org/w3log/08.mar.html#Engarrafamento</guid>

</item>

<item>
<title>Nova aquisição</title>
<link>http://www.diale.org/w3log/08.mar.html#Nova%20aquisição</link>
<description><![CDATA[
<img src="../images/pipes/DSCN4001.jpg" alt="">

<p><a href="../pipas.html">Ver mais...</a></p>

]]></description>
<author>Tiago Charters de Azevedo</author>
<pubDate>Tue, 18 Mar 2008 00:00:00 WET</pubDate>
<guid>http://www.diale.org/w3log/08.mar.html#Nova%20aquisição</guid>

</item>

<item>
<title>IBERICOS, IIIrd Iberian Cosmology Meeting</title>
<link>http://www.diale.org/w3log/08.mar.html#IBERICOS%2C%20IIIrd%20Iberian%20Cosmology%20Meeting</link>
<description><![CDATA[
<!-- 
\sf
{\Huge\bf  IBERICOS}

{\Large IIIrd Iberian Cosmology Meeting}

Lisboa, Portugal -- 2008
--><img src="./latex/latex2png-08.mar__3189930339.png" alt="latex2png equation" class="latex-display">

<p><a href="http://ibericos.cii.fc.ul.pt">http://ibericos.cii.fc.ul.pt</a></p>

]]></description>
<author>Tiago Charters de Azevedo</author>
<pubDate>Wed, 05 Mar 2008 00:00:00 WET</pubDate>
<guid>http://www.diale.org/w3log/08.mar.html#IBERICOS%2C%20IIIrd%20Iberian%20Cosmology%20Meeting</guid>

</item>

<item>
<title>Algumas funções em Lisp para o algoritmo de Porter</title>
<link>http://www.diale.org/w3log/08.mar.html#Algumas%20funções%20em%20Lisp%20para%20o%20algoritmo%20de%20Porter</link>
<description><![CDATA[
<p>Como <a href="08.fev.html#Algoritmo%20de%20Porter">referido no mês passado</a> apenas sobrou a ideia e a vontade &quot;numa mão cheia&quot; de funções.


<pre>
(setq max-lisp-eval-depth 100000)
(setq max-specpdl-size 10000)
</pre>
</p>


<h3>Funções auxiliares</h3>

<pre>
(defun list-to-string (l)
  "Return a STRING which is the concatenation of the elements of
L."
  (if (not l)
      nil
    (if (stringp (car l))
	(concat (car l) (list-to-string (cdr l)))
      (list-to-string (cdr l)))))

(defun join-string (xs &optional sep)
  (cond ((null xs) "")
	((null (cdr xs)) (car xs))
	(t (concat (car xs) (or sep "") (join-string (cdr xs) sep)))))

(defun string-to-strings (s)
    "Convert a string into a list of strings."
    (let ((i (- (length s) 1)) (l '()))
      (while (<= 0 i)
	(setq l (cons (aref s i) l)
	      i (- i 1)))
      (mapcar (lambda (x) (char-to-string x)) l)))
</pre>



<h3>Definição das vogais em português</h3>


<pre>
(setq vn (string-to-strings "aeiouáàéíóúâêôAEIOUÁÀÉÍÓÚÂÊÔ"))
(setq vnc (mapcar (lambda (x) (string-to-char x)) vn))
</pre>



<pre>
(defun vowelp (v)
  "É v uma vogal? Sim -> t, Não -> nil. "
  (if (eq () (memq  (string-to-char v) vnc)) nil t))

(defun consonantp (v)
  (if (vowelp v) nil t))

(defun tilde-rm (v)
  "ã -> a~, õ -> o~"
  (cond ((eq  (string-to-char '"ã") (string-to-char v)) "a~")
	((eq (string-to-char '"õ") (string-to-char v)) "o~")
	(v)))
</pre>



<pre>
(defun tilde-rm-string (str)
"Avião Cão-> Avia~o Ca~o"
  (join-string (mapcar (lambda (x) (tilde-rm x)) (string-to-strings str))))
</pre>




<pre>
(defun m (str)
  "#CV como está definido no artigo original do Porter"
  (let* ((i 0) (count 0))
    (while (< i (- (length (sts-rm-tnil str)) 1))
      (if (not (eq (nth i (sts-rm-tnil str)) (nth (+ i 1) (sts-rm-tnil str))))
	  (setq count (+ 1 count)))
      (setq i (+ i 1)))
    (if (evenp  count) (/ count 2) (/ (+ 1 count) 2))))
</pre>




<pre>
(defun R1 (str)
  "Returns R1 part of the word."
  (let*  ((lstr (string-to-strings(tilde-rm-string str))))
    (if (> (length  lstr) 1)
	(if (vowelp (car lstr))
	    (if (consonantp (cadr lstr))
		(join-string (cddr lstr))
	      (R1 (join-string (cdr lstr))))
	  (R1 (join-string (cdr lstr))))
      )))
</pre>




<pre>
(defun R2 (str)
  "Returns R1 part of R2."
  (R1 (R1 str)))
</pre>



<pre>
(defun RV (str)
  "Retunrs de RV part"
  (let*  ((lstr (string-to-strings(tilde-rm-string str))))
  (cond
   ((consonantp (cadr lstr ))
    (if (vowelp (caddr lstr))
	(if (consonantp (car (cdddr lstr)))
	    (join-string (cdddr lstr)) (join-string (cddddr lstr)))
      ((and (vowelp (car lstr)) (vowelp (cadr lstr)))
       (join-string (cdddr lstr)))))
   ((> (length  lstr) 3)  (join-string (cdddr lstr))))))
</pre>



<pre>
(defun sort-list-words-length (lstr)
  "Ordena as palavras, numa lista, por ordem decrescente do número de letras."
  (let ((j 0))
    (while (<= j (length lstr))
      (let ((i 0))
	(while (<= i (length lstr))
	  (if (< (length (nth i lstr)) (length (nth (+ 1 i) lstr)))
	      (swap lstr i (+ 1 i)) nil)
	  (setq i (+ 1 i))))
  (setq j (+ 1 j))))
  lstr)
</pre>



<h3>Lista de sufixos</h3>


<pre>
(setq list-suff
      '("eza" "ezas" "ico" "ica" "icos" "icas" "ismo" "ismos" "ável"
	"ível" "ista" "istas" "oso" "osa" "osos" "osas" "amento"
	"amentos" "imento" "imentos" "adora" "ador" "ação" "adoras"
	"adores" "ações" "ante" "antes" "ância"))
</pre>


<pre>
(setq list-suff-verbs
     '("ada" "ida" "ia" "aria" "eria" "iria" "ará" "ara" "erá" "era" "irá" "ava" "asse"
       "esse" "isse" "aste" "este" "iste" "ei" "arei" "erei" "irei" "am" "iam" "ariam" "eriam"
       "iriam" "aram" "eram" "iram" "avam" "em" "arem" "erem" "irem" "assem" "essem" "issem"
       "ado" "ido" "ando" "endo" "indo" "arão" "erão" "irão" "ar" "er" "ir" "as" "adas" "idas"
       "ias" "arias" "erias" "irias" "arás" "aras" "erás" "eras" "irás" "avas" "es" "ardes"
       "erdes" "irdes" "ares" "eres" "ires" "asses" "esses" "isses" "astes" "estes" "istes"
       "is" "ais" "eis" "íeis" "aríeis" "eríeis" "iríeis" "áreis" "areis" "éreis" "ereis"
       "íreis" "ireis" "ásseis" "ésseis" "ísseis" "áveis" "ados" "idos" "ámos" "amos"
       "íamos" "aríamos" "eríamos" "iríamos" "áramos" "éramos" "íramos" "ávamos" "emos"
       "aremos" "eremos" "iremos" "ássemos" "êssemos" "íssemos" "imos" "armos" "ermos"
       "irmos" "eu" "iu" "ou" "ira" "iras"))
</pre>



<pre>
(setq list-res-suff '("os" "a" "i" "o" "á" "í" "ó"))
</pre>



<h3>Alguns testes</h3>

<pre>
(R1 "Aleatoriamente" );"eatoriamente"
(R2 "Aleatoriamente" );"oriamente"
(RV "Aleatoriamente" );"toriamente"
</pre>



]]></description>
<author>Tiago Charters de Azevedo</author>
<pubDate>Sun, 02 Mar 2008 00:00:00 WET</pubDate>
<guid>http://www.diale.org/w3log/08.mar.html#Algumas%20funções%20em%20Lisp%20para%20o%20algoritmo%20de%20Porter</guid>

</item>

<item>
<title>Arquivo</title>
<link>http://www.diale.org/w3log/08.mar.html#Arquivo</link>
<description><![CDATA[
<p>- <a href="08.fev.html">2008 - Fevereiro</a> [<a href="./08.fev.xml">RSS</a>]</p>

<ul>
<li><a href="08.jan.html">2008 - Janeiro</a> [<a href="./08.jan.xml">RSS</a>]</li>
</ul>

]]></description>
<author>Tiago Charters de Azevedo</author>
<pubDate>Sat, 01 Mar 2008 00:00:00 WET</pubDate>
<guid>http://www.diale.org/w3log/08.mar.html#Arquivo</guid>

</item>

  </channel>
</rss>
