Tag Archives: python

Using reduce in Python.

Python has a built in operator called reduce. This is just another name for what a functional programmer would called a fold. They’re really useful, but you don’t know so until you actually need one. The easiest example to understand is listed below and is the same example provided on Python’s documentation. lon = [1, [...]

Posted in Programming | Also tagged , | Leave a comment

Using the Stanford Parser with Jython.

The following code is a Jython adaptation of the example Java code that comes with the Stanford Parser. I felt like this would be pretty useful to have as a resource because Python doesn’t have a parser that generates grammatical relationships in a sentence, and I wasn’t able to find any example code to help [...]

Posted in NLP, Programming | Also tagged , , | Leave a comment

Applying functions to arguments in Python.

One of my favorite features of functional programming languages is that you can treat functions like values. You can assign them like any other value, but most interestingly you can apply them! Though Python requires that you use a special notation to do so, I wanted to write this down so that it is clear [...]

Posted in Programming | Also tagged | Leave a comment