DLPO scraping

May 1st, 2008

I’ve put up a code snippet that can be used as a shell script, in order to consult the DLPO (portuguese) dictionary. It’s a simple HTML scraping (html5lib + BeautifulSoup) example, but it’s really useful (at least for me).

Example:

  1. mahound@magrathea ~ $ dlpo português
  2. * adj.,
  3.          - relativo a Portugal;
  4.          - diz-se de uma variedade de trigo-mole;
  5. * do Lat. portucalense
  6. * s. m.,
  7.          - indivíduo natural de Portugal;
  8.          - indivíduo que tem nacionalidade portuguesa;
  9.          - língua falada pelos Portugueses, Brasileiros e todos os povos africanos de língua oficial portuguesa;
  10.          - antiga moeda de ouro.
  11. * fig.,
  12.          - franco, leal, apesar de rude;
  13. mahound@magrathea ~ $

Mark V. Shaney

March 31st, 2008

Noah Slater called my attention to this:

He’s doing something similar, using an IRC bot. At first, it fooled me… it looked like a quite literate human on drugs.  Then, I started noticing some patterns, and eventually found out. However, I’m still kind of embarrassed about this… my faith on the Turing test has decreased, not because machines are supposedly getting smarter, but rather because i start to believe that the conditions of a hypothetical “Turing test” should be more constrained than previously thought: i.e. the machine should convince the human that he’s talking with a sane and sober human being.

Go, Yasi, go!

March 22nd, 2008

15 year-old prodigy… no need to say more…

Oh, and she’s been playing for 3 years…

I guess I won’t touch a guitar again…

OpenID

March 22nd, 2008

Just added OpenID support to the weblog. I’ve disabled registration, so that everybody that doesn’t still have an account has to go through OpenID in order to login. I’m sick of phony users and spam bots…

If you don’t have an OpenID, create one… it’s quick, and it works for lots of websites.

This morning…

March 21st, 2008

The landscape in St. Genis-Pouilly(GEO:  46.245616, 6.028238) was like this:

Snow in St. Genis, 20080321

The Songs of Distant Earth

March 18th, 2008

Falling asleep to Mike Oldfield’s rendition…

R.I.P. Arthur C. Clarke (1917 - 2008).

We’re linked!

March 17th, 2008

Yes, now this blog is part of the Linked Data community. Thanks to triplify, all the posts and comments contained in this blog can be exported as RDF (N3 or JSON-encoded). The source is http://weblog.zarquon.biz/triplify/ (default: N3, use http://weblog.zarquon.biz/triplify/?t-output=json for RDF/JSON).

The output is still a single graph (much like a dump), but I’m confident that the triplify guys will soon start using different contexts, and make the URIs browsable.  In any case, it’s already possible to link these data with, i.e. FOAF info, using  foaf:mbox_sha1sum.

Contexts in rdflib

February 29th, 2008

A short example…

  1. from rdflib import Namespace, BNode, Literal, URIRef
  2. from rdflib.Graph import Graph, ConjunctiveGraph
  3. from rdflib.store.IOMemory import IOMemory
  4.  
  5. ns = Namespace("http://love.com#")
  6.  
  7. mary = URIRef("http://love.com/lovers/mary#")
  8. john = URIRef("http://love.com/lovers/john#")
  9.  
  10. cmary=URIRef("http://love.com/lovers/mary#")
  11. cjohn=URIRef("http://love.com/lovers/john#")
  12.  
  13. store = IOMemory()
  14.  
  15. g = ConjunctiveGraph(store=store)
  16. g.bind("love",ns)
  17.  
  18. gmary = Graph(store=store, identifier=cmary)
  19.  
  20. gmary.add((mary, ns[‘hasName’], Literal("Mary")))
  21. gmary.add((mary, ns[‘loves’], john))
  22.  
  23. gjohn = Graph(store=store, identifier=cjohn)
  24. gjohn.add((john, ns[‘hasName’], Literal("John")))
  25.  
  26. #enumerate contexts
  27. for c in g.contexts():
  28.     print "—- %s " % c
  29.  
  30. #separate graphs
  31. print gjohn.serialize(format=‘n3′)
  32. print gmary.serialize(format=‘n3′)
  33.  
  34. #full graph
  35. print g.serialize(format=‘n3′)

xOperator - Semantic Web Jabber Bot

February 28th, 2008

A very interesting concept… I’ve been playing a bit with it: http://groups.google.com/group/xoperator/browse_thread/thread/11397420fb298dea .

do you remember… ptCTF?

February 25th, 2008

Do you remember that specific project that you started 7 or 8 years ago, and just didn’t have the will/time/manpower to maintain? Well, one of my early experiences happened when I was 16: ptCTF, a “Capture The Flag” extension for Half-Life, that I developed with some friends in high school. It seems, it was not totally forgotten…

At the time the objective was to create a portuguese-stereotype kind of game. Therefore, the scenario was a North vs. South war, one of the few (and, yet, artificial) ways in which we can split the portuguese culture. Some details were meant to be purely stereotypical, like the wine bottles that served as health packs, etc…
Well, it was essentially a failed project, as a whole (only the initial version was released, and no-one would want to play it, since there were far better alternatives), but i see that at least it hasn’t died, deep inside the mind of some (older) portuguese gamers.
Just as an aside, I believe that this project marked my first contact with the MingW32 gcc/glibc port, that eventually lead to my conversion to GNU/Linux.

Tags: , , , ,