You've often heard me talk about Python as a superpower.
It can amplify whatever you're interested in or what you've specialized in for your career.
This episode is an amazing example of this.
You'll meet Cornelius van Litt.
He's a scholar of medieval Islamic philosophy and works at Utrecht University in the Netherlands.
What he's doing with Python is pretty awesome.
Even if you aren't interested in digital humanities and that type of research,
the example set by Cornelius is a blueprint for bringing Python into your world and for those around you.
I think you'll enjoy this conversation.
This is Talk Python to Me, episode 230, recorded August 27th, 2019.
Welcome to Talk Python to Me, a weekly podcast on Python, the language, the libraries, the ecosystem, and the personalities.
This is your host, Michael Kennedy.
Follow me on Twitter where I'm @mkennedy.
Keep up with the show and listen to past episodes at talkpython.fm.
And follow the show on Twitter via at Talk Python.
This episode is brought to you by the podcast Command Line Heroes from Red Hat and Linode.
Please check out what they're offering during their segments.
It really helps support the show.
Hey, folks.
Before we get to the interview, I have some exciting news.
We've teamed up with Humble Bundle to launch a great bundle of Python educational goodness.
For a couple of weeks, you can get three of our courses along with great content from RealPython, PyBytes, and many others for as little as just $1.
If you've been on the fence about trying one of our courses, here's a chance to get three of them along with a bunch of other great stuff.
Just visit talkpython.fm/HB2019.
That's HB2019.
And be sure to check it out before time runs out.
Now, let's get to that interview.
Cornelius, welcome to Talk Python to Me.
Thanks for having me.
It's great to have you here.
I know we're going to have a fun conversation talking about digital humanities, which, honestly, I didn't know a whole lot about before we started talking.
But it's really a cool intersection of, well, humanities and software.
That's right.
And it's only growing and growing.
And soon it will just consume the entirety of the humanities.
That's our goal.
There was this article recently written that Python is eating the world.
And it may be true.
We'll see about that as we go.
Before we get into all that, though, let's start with your story.
How did you get into programming in Python?
Well, this goes back many years.
It was actually, if you will believe it, the last year of my elementary school, I programmed the website of the school.
This is 1999.
So I just did it in notebook.
That's amazing.
Yep.
Just HTML tags.
There weren't really any IDEs, at least not that I know of.
There was like front page and Dreamweaver.
But, you know, that was kind of cheating in a way.
Yeah.
It was like you write in Word and then like you publish it as a web page.
That was weird, right?
Everybody knew that that was not the right way to do it.
That's right.
Yes, they did.
So, wow, that's really young.
How did you even get that opportunity to do that?
I don't know exactly how I got this book.
It was some sort of, you know, HTML for dummies kind of book.
And that's what I used.
And I guess I just showed it to one of the teachers and he was like, well, actually, this school doesn't even have a website yet.
So that's really cool.
After that, my dad gave me this brick of a book on visual basic thinking that, well, okay, that visual elements to it, you know, but that was way too hard.
And it's really so great to see that there's so many resources out there now for children to learn programming.
That's really cool.
It's really amazing.
I talk to people who, like, what their experience was who are our age and generally that age.
And it's like, well, I got a magazine and then I would type in, like, the C code into something.
And then I would make that run.
And that's how I learned programming.
And then I see my daughters and stuff.
And, you know, there's, like, adventure games where you program your way through dungeons and, you know, robots and all sorts of stuff.
And I'm like, wow, that is a long way from, you know, typing in, hello world, you know, 10, hello world, 20, go to 10.
That's right.
But I guess I did feel very attracted to that kind of thing.
So, eventually, I learned of Flash, which is dying as we speak.
It's horrible.
So, I got in that when it was still developed by Macromedia, Flash 4.
And this was a really great combination for me to be both a designer and developer.
So, I did this for my daughters.
You can do really interesting stuff.
And, like, Flash is properly the whipping boy these days.
It gets beat up and is getting ostracized.
And that's probably a good thing.
But, you know, the timeframe that you're talking about learning it, it was really powerful.
And it was really unique.
And it, you know, we didn't have HTML5 and JavaScript that worked well everywhere.
And you could do interesting stuff with that.
A lot of things were done with it.
I've only kind of recently come back into programming.
And I was just stunned by what JavaScript had become.
You know, in 1999, you could do an alert box.
That was kind of it.
Yeah, exactly.
We can validate this text or whatever, yeah.
It's been such a huge change in that world.
And that was so recently, like 2016 or so, that's when I got sort of reintroduced to real programming.
And Python quickly came on my radar.
And I've been kind of incorporating it into my work as a Swiss army knife.
I use it for all kinds of things.
And I also noticed that I reach for it faster and faster.
More quickly, I think Python has a good solution to my problem.
Yeah, that's really interesting.
And when you say you're incorporating it, I know the stuff that you're doing that we're going to talk about.
It's deep and meaningful stuff.
It's not like a little quick little automation of like some Excel file or something.
There's real stuff that I think is really powerful programming that you're doing.
So maybe that's a good way to segue into what do you do day to day as your main job.
By trade and profession, I'm a scholar of Islamic studies.
So that means that I spend most of my time alone.
I do research.
I'm a postdoctoral researcher at Utrecht University.
And I've got my own project funded by the Dutch Research Council.
And this is really about philosophy from the 12th century, from the Islamic world up until could be the 19th century even.
And so I read a whole discussion of all kinds of people through these centuries.
We're all talking in my project specifically.
I work on the imagination.
And a lot of these texts are in printed editions, but some of them are in manuscripts.
So there's a lot of just sitting down with the text and reading them.
That's what my job is supposed to be.
But then came Python, basically.
Yeah, of course.
Well, I look at these manuscripts and I haven't read old Islamic ones because I don't read any of those languages.
But I do remember trying to read some of the mathematical ones from like Newton and stuff when I was studying it.
And these do not seem like writing that would easily be understood by computers.
It's not like nearly printed text or something like that, right?
It's handwritten, kind of one-off, unique stuff.
The calligraphy was really beautiful back then.
People could write really well.
But still, it doesn't seem like a first blush.
A computer should be able to just take it on.
But working with manuscripts is a real skill.
And it's a real complicated skill that needs a lot of training for very specific periods, very specific types of hands, of scripts, basically.
And as far as what you just mentioned about, you called it calligraphy, and rightly so.
And just think of it.
Back then, when you wanted to put down knowledge, you just really had to take a pen, take ink, a paper, and then write it down by hand.
And the fastest way to do that is to not release your hand, not release your pen from the paper.
So that's why cursive is all connected, because that's simply the fastest way to put this down.
I'm looking at text that are sometimes spanning like 600 folios of handwritten text.
It's amazing to think that somebody 500, 600 years ago did this.
It's really amazing, those old manuscripts.
So maybe before we get into any of the technical side of things, it might be worth just setting out some of the questions that you try to answer, right?
As part of your research, you know, put the tech aside for a minute.
Like, what are some of the things, some of the outcomes you're looking for and stuff?
In my real research, you're looking for, so the basic, sort of the very overarching thesis that I am approaching is the late medieval, early modern period in Islam, in the Islamic world.
Is that a period of sort of intellectual decay and sort of darkness, or is there actually much activity going on?
And the former has been argued for and also sort of made into a political argument and plays in a significant role in geopolitical discussions right now.
So there's sort of the societal relevance of my research.
But then to do that, I really go down to the actual evidence that we have, the texts, and where other people kind of discarded, not looked at it.
I say, okay, let's look at what are these people talking about.
And I do that mainly through what are called commentary traditions.
This was a very much-used device in those centuries that you didn't really write a text of yourself, but you took a text from before, and then you copied it, and then you added comments to it.
So this way, you have a very structural, very secure way of knowing that these two people, even though they're separated by centuries and continents, they're interacting.
They're talking to each other somehow.
And right now, I'm looking at a commentary tradition of 140 commentaries.
So there's a lot of things to sort out, and usually they do not name the person that they're referring to.
So you have to do a lot of triangulations, basically, to get to understand what is the movement of the discussion over the centuries.
I see.
So you almost can study how, like, thought around this common idea has evolved over time, or one thinker influenced the other, something like this.
That's exactly what I'm after.
So it's also to sort of fight off essentialism or some sort of idea that they're all talking about the same.
Now, usually there is a very subtle movement in the discussion.
And for me right now, this is about the imagination, about what does it mean that we can imagine?
Are imagining things real or are they not real?
And this is also then for these people placed in a religious context.
Does the imagination play a role in prophecies and, for example, mystical experiences, say?
Okay.
Yeah, that sounds really interesting.
And obviously, you need to understand the manuscripts and lots of them.
I think at this keynote, I don't remember where it was.
You'll have to maybe let everyone know.
And we'll link to it.
It's on YouTube, and it's really interesting.
You had talked about how there's a common set of papers and manuscripts and stuff that people have studied over and over and are recorded and understood.
But like 99% of the writings that people do just kind of vanish, right?
Yeah.
So in a manuscript world, when somebody thinks of a profound idea and he writes it down, he uses a pen, ink, paper to put it into writing.
Now you have, you know, the idea is of population and is one.
Yeah.
And so you better hope that somebody comes along and says, oh, I'll take the time to copy it and, you know, copy it onto another piece of paper and then sort of distribute it from there.
So it's very different from the print world where in one swoop you can have, you know, a hundred or a thousand copies of a text and distribute it across a whole continent.
So this way, copying in the manuscript world is incredibly important.
So that's why I try to sort of encapsulate my methodology.
Instead of looking at all writings of one author, let's look at all authors of one text.
Yeah.
That's an interesting twist.
So one of the things I really like about your story and that I think will become apparent is this interesting juxtaposition of the very old and the very new, right?
Like we're talking about applying artificial intelligence to understand manuscripts from 900 years ago or something like this, right?
These are both extremely cutting edge and like we don't even really use manuscripts in modern day things and bringing them together.
And I think another interesting one is that you said that you are a friar of the order of preachers, which I think is pretty interesting.
And also I think it's just another interesting aspect to what you're doing around technology.
Well, yes.
The order of preachers, also known as the Dominicans.
It's a religious order of the Catholic Church founded in the 13th century.
And in fact, I stand in a long tradition of Dominicans who have introduced technology and have sort of thought about what technology means when a printing press came along, the Dominicans were there.
And now also in the digital world, there is a network of friars.
It's called Optic.
And they think a lot about the ethical aspects of sort of the digitization of our lives.
What does that mean to us?
How can we still be – what does it mean to be a human in a digital world really?
So kind of my work is sort of close to that.
But of course, I also have to sort of smile sometimes when I – late at night, I'm coding and then I look down and I notice that I'm wearing my habits.
Yeah, it's a very interesting juxtaposition.
And I think there probably is not exactly the same but in a similar sense, a kind of a culture clash when you think about using computer technology and computer programming to do digital humanities.
So maybe let's try to define that term broadly because I think we've defined it – started to define it for what you're doing.
But in a broad sense, what is digital humanities?
Yes, it's a term that refers to the use of computer technology in humanities research where humanities research relies on human artifacts.
That's basically the sort of the raw material of humanities research like architecture, art, texts, all of that.
And so usually our laboratory has always been the library and we're just, you know, stack up a whole bunch of books and do our thing.
And now we're seeing like, okay, how can we use computer technology?
How can we unleash that computing power that we know is literally at our fingertips?
And this is especially important because sort of unbeknownst to ourselves, so much of our workflow has already been coming into the digital world.
Of course, we don't write our books by hand anymore.
We write them on a computer.
And most of our journal articles, we take them from online databases.
But a lot of the issues with it have not been thought out exactly.
And the people who have sort of gone into this direction usually have gone all the way, so to say.
They have really made digital humanities into a field of its own.
And their main purpose now is to really push the technological boundaries to see what kind of new technology could be possibly applied to the humanities.
But without really coming back with sort of real results for other colleagues in the humanities.
So that sort of caused a rift or a divide between what you can then call classical humanities and digital.
Yeah, I can definitely see that.
You know, you can just keep going down the computer side of things.
But, you know, here you are trying to answer these very traditional sort of philosophical questions using source material that's, like I said, 900 years old, written by hand.
And yet you're bringing in some really cool technology to do it.
Maybe let's just set the stage quick by talking about some of the things you're actually studying, like these scrolls with their flaps and so on.
And some of the technology that you're applying to it.
Right, yeah.
So I think sort of the most interesting aspects of my Python work applied to manuscript studies has been the automated image analysis of Kodishes.
And this comes because we have digitized so many manuscripts.
Actually, we didn't mention this before, but this is really a key element to all of this.
Libraries around the world have digitized thousands, hundreds of thousands of manuscripts, meaning they take photos of the entire manuscript of every page.
They take a photo.
And now you have a folder with like 300 images.
And so I took, instead of one folder, I took like a whole collection of folders.
I had at my disposal 2,500 manuscripts digitized.
And so I took only the first image, which is of the cover of the binding, right?
Right.
It's like kind of a leather wrapper of it.
And it has like a foldable flap.
And it sounded to me like knowing some details about that would tell you about maybe the origin or the timing or something of that nature.
Exactly.
So in the Islamic world, these manuscripts always have a flap that goes back onto the front to really encapsulate the entire codex, the entire manuscript.
And I thought it would be interesting to analyze the shape of that codex and particularly the angle that the flap makes, which is a thing that this is truly then a new question.
It shows that digital humanities can ask these new questions.
There's nobody thought of measuring the angle of the flap before.
And if you can do it for one, then you can just iterate it over.
It's a four.
Yeah, if you can do it for one, it's a four loop.
Exactly.
That's the beauty of it.
And yeah, it gives you another data point, right?
If you think of it as data point, then it gives you another, perhaps a small argument if, say, all manuscripts from the 17th century have this kind of angle.
And now you have an undated manuscript that has kind of that angle on the flap.
Well, that's another argument in favor for dating it back to the 17th century.
This portion of Talk Python to Me is brought to you by Command Line Heroes.
Season 3 of Command Line Heroes is all about programming languages.
Episode 7 covers the history of AI, starting with its first language, Lisp.
It was created to teach machines how to learn like humans.
And at the start, there was a wave of interest and investment.
But ultimately, the timing and hardware wasn't quite right for AI to work.
Decades later, AI is now on the verge of changing everything.
Get the full story and subscribe wherever you get your podcasts or just visit talkpython.fm/heroes.
Just to give folks who have not watched your keynote and probably, you know, visually it's a little hard to understand.
Think of like a folded out sheet of paper where there's like a triangle bit, maybe some kind of fastener on the end of it, and then like a big rectangle.
And you're using OpenCV and Python and various things to like understand like that last triangle part, right?
That's right.
And once I had completed it, basically, once I really had it figured out, I understood that this is a really good example of applying technology to humanities research.
Because OpenCV and Python are now sort of easy enough to use to learn it as you go, basically.
And especially, this is especially a good thing about OpenCV.
It's a very powerful library.
And that I'm able to use it already now shows actually just how highly developed OpenCV is.
Right.
And it seems like the understanding that, like I have a picture and that I want to find this triangle in it.
That seems like a really hard problem.
But it sounds like the tools have come along to get really good, huh?
Yes.
But at the same time, as like the tools are relatively easy to use, you also see that now you give it a humanities problem.
And all of a sudden, like you're really kind of pushing the technology to its very least.
Because OpenCV was developed for, you know, receipts, for automated analysis of receipts of chess games, of video feeds, of, you know, gas stations, like how many people are in the store.
Those kinds of relatively easy tasks for OpenCV apply that to manuscripts, of photos of manuscripts.
And all of a sudden has a much harder time coming up with anything meaningful.
You have to take a lot of in-between steps to reduce it, to reduce the image in a way and shape it in a way that you get out of it what you want.
Yeah.
I can definitely imagine that.
And, you know, people should watch the videos and just see some of those manuscripts.
Because it, like I said at the beginning, it doesn't seem at first glance that like, oh, I could just take that image and point that at some sort of algorithm and get super meaningful stuff out.
But we're going to dig into some of the cool things that you did do.
Before we move on from this kind of introductory stuff, though, I do want to circle back just a little bit.
So it sounds like in this digital humanities world, there's kind of like this scientific philosophy of trying to understand stuff like sort of in a computational way.
And then there's the humanities part where, you know, it's sort of more traditional studies.
And you said there's a couple of possible paths organizations and academics and stuff might take.
Like one would be to like build up a team of some researchers and some programmers or, you know, maybe you could teach yourself or things like that.
Do you want to kind of work us through that?
Yes.
So this starts from the observation that there's kind of a it's been called the two cultures problem where sort of sciences versus the arts.
And there's sort of really a paradigm difference between them has this very good sort of summary of it.
He says in one of his books, he says, gray is all theory, but green is the golden tree of life.
With OpenCV, this is all too real because the first thing you do with a color image is reduce it to a gray scale.
So the sciences, people from coming from the sciences, trying to work on humanities problems all too often, they way too quickly think that they can rely on a calculation and then be very sure about the outcome of it.
And sort of their assurance of their methodology trips them up when it comes to humanities problems, which don't always have a yes or no answer to them.
But the humanities, then they're really sort of deeply grounded problem is that they just can't really understand what technology could give them.
So oftentimes they think that things that they think are they should be so easy.
They're incredibly hard for technology.
When I talk about digitized manuscripts, obviously they're saying, oh, so like OCR, like you can read the text out of it.
No, that's not.
Have you seen this text?
Exactly.
No, that's really interesting.
You know, honestly, I can see that that community would have that perspective.
But at the same time, a lot of people do who are not actual programmers.
A lot of things when you're doing programming, like that must be hard.
You're like, no, actually, that's like three lines of code.
And they think this other thing is really easy.
And you're like, no, that's like two more weeks of programming.
That's really hard.
That's thing.
You're just, I know it looks like a small step.
It is not a small step, right?
It's just how software is.
Exactly.
Yes.
It's like there's a whole research team working on it for five years now.
They haven't gotten it yet.
Exactly.
You're getting close.
It sort of brings this huge divide between the two, right?
And so for most purposes, people try to solve this like, okay, let's work in teams with an engineer and a humanity scholar.
But then you get this sort of Babylonian problem of that.
You know, it's very hard for them to talk to each other.
And so I am much more in favor of learning the tech yourself, which I think is really doable at this particular point in time.
It's the tech is high level enough.
And it also gives you very fast return on investment.
You can really learn on the job, so to say.
And so I want to really like to see people sort of occupy that middle space in between the humanities and the digital.
Right.
Without completely sort of abandoning that side, the humanities side and just going, I'm going to become a programmer, but sort of continue doing your work, but actually gain some of these digital skills.
That's right.
And the more I thought about this and the more I wrote about this on my website, digitalorientalist.com, I thought, okay, actually, it's not just one middle position, but it's kind of we should think of it as a spectrum.
You know, where are you on the DH spectrum?
That's what I'd like to think about it.
And I sort of distinguished six archetypes in the spectrum.
You saw it in the keynote.
Yeah, yeah, yeah.
So you started out with the believer who is somebody who knows, like, actually, I've seen what you've done.
I agree with it.
This is amazing.
Let's go down that path, right?
Those who are really doing programming themselves, who are kind of 100% of their time doing programming as part of their humanities research somehow.
Yeah.
And just to the left of them, you have the sour one, which are also programmers, you know, full on.
But they really, they want to share their newfound, you know, things, their newfound results.
They want to share it so much with the rest of humanities.
But a lot of colleagues, you know, they find it very hard to understand, just as we have also found it hard to talk about this example that we discussed about analyzing the Kodishes, the angle of it.
And so they've become really turned off.
And I've had these Skype conversations with people where I was reaching out to them, very enthusiastic.
And I quickly realized that I was asking questions that they heard like a million times and they thought I was up to no good or something.
And so very quickly, these conversations escalate in a way that's really not necessary.
Yeah.
I wonder about the sour one category.
I feel like if you had tried to solve these problems 10 years ago in the same way that you're solving them now, it might have been much harder and much more fruitless.
Right. Like before OpenCV and simple Python packages and stuff, you might be like, well, we tried this, but we're not like a tech company.
We're not going to be able to do this.
So it's never going to work.
And they just maybe didn't come back or something.
I don't know.
What do you think?
Oh, yes, there's there's definitely part of that.
Or they just slaved and labored for years and years and sort of got the same result that I now got in, you know, with like you said, like just a couple of lines of code, you know.
Yeah.
Like, yeah, this is how we're supposed to do this.
I mean, that's just a challenge of things moving so fast, moving on.
All right.
So the next one of your archetype is the spider.
Right.
And so the spider is usually a full professor who is the leader of a research team.
They have this magic ability to attract grants.
It's a very useful skill.
Very strong currency in academics.
Like papers and you have grants.
These are the two.
Yes.
Money is hard to get by.
And, you know, these professors, they wouldn't program themselves, but they have sort of reading knowledge.
And they understand at least the concepts of it.
And but they have the ability to collect these people around them, put them in connection and let the people who are able to do it, you know, really shine.
So I think a lot of good can come from the spider.
Yeah, absolutely.
I agree.
I've seen that in other contexts, although I didn't call them that.
But yeah, I think that's a very positive place to be in academics.
Absolutely.
Yes.
So then you have like a team structure that actually functions quite well because there's not a big divide between engineers and scholars, researchers of the humanities, but it's integrated into one basically.
Now, sort of a smaller scale of that you have in what I call the blind and the lame.
So now you don't have a team, but you just have two persons.
And the lame one is the professor again, but maybe like an associate professor or somebody who has heard like, oh, the H is all the fashion.
So I need to do something with this.
But I have absolutely no idea.
So I'm going to hire a student or an engineer to do the work for me.
And this is definitely headed nowhere, really, because it's so hard to talk to each other, to come to a meaningful conclusion.
And even if you have everything kind of working, then usually the result is like, well, a representative is this to make a claim that the data is trying to make.
Or the way around, are we now just proving the – if it's corresponding with the erudition of scholars of many generations before, is this just proving the erudition or is the erudition actually proving the software?
Like is the software now validated because it's in accordance with the opinions of scholars before?
Yeah, of course.
So what I think is really the best place to be in the DH spectrum is to reduce that two-person team into one person.
So I call that the centaur.
Yeah, that's the person who is on or the creature whose top half is a human and the bottom half is a horse, right?
That's right.
So it's got still a human head, a humanistic head.
But the legs are already digitizing basically, able to move by him or herself in the digital sphere, making use of digital tools.
I see that with PhD students now.
This is now kind of the generation who's really investing real time into acquiring these kinds of skills.
What is your experience with people who are in the humanities?
So they probably were not super drawn to like computer science type of subjects.
What is their experience when you say, hey, you know, it really makes sense for you to learn a little bit of programming or to explore this technical side of things?
Are they excited?
Are they resistant?
Are they nervous?
It really varies because even just putting up numbers in your article or your book, I really have to comment like, what are you trying to make me do here?
Mathematics?
Like, what are these numbers for?
Is this a graph?
Are you kidding me?
Is this a graph?
Did that come from Plotly?
Yeah.
It really is challenging because even now, a lot of students in the humanities, they kind of use the computer just as a typewriter in a way.
And, you know, I'm also really kind of concerned about this sort of the digital literacy of our society in general as our technology is.
It's all so polished.
You know what I mean?
Like Facebook and all these websites.
All the mobile apps.
Yeah, they look so good and smooth.
It just works.
Yeah, I get that.
That's a great, you know, marketing statement.
But it also makes you not really think twice about how it works and why it works that way.
So you really have to show them immediate benefits.
And it has to be low-hanging fruit.
You can't force them to like, okay, well, just learn Python for half a year and then come back.
It has to be a very, very quick return on investment.
Yeah, and that's probably why Python is working well.
In this situation, right?
Because you can be productive with a partial understanding of Python.
You never have to know what a function, a class, a generator, a database, any of these things are.
And you can still have outcomes, right?
Just top to bottom.
It does this.
Here comes the analysis or whatever.
That's right.
And to sort of to beef that up, I recommend to people, well, just listen to podcasts like this one.
And just do that in your spare time when you're exercising or whatnot.
You don't have to understand it.
That's not the point.
Just hear the words they're saying.
And if words are repeated and it sounds interesting, it's maybe an interesting context.
Then maybe then look it up and see what it is.
You know, it's really interesting.
When I first started this podcast like four and a half years ago, my expectation of who my audience member was, was a dedicated expert.
Somebody who loves Python and programming enough that not only do they do it as their hobby or their job, but they also do it in their spare time and they listen to the background stories of it, right?
And what I found out is that many of the listeners, maybe over half, are like beginners who are more trying to do a tech immersion type of experience, right?
They don't, they'll write me and say, hey, I love your show.
It's really entertaining.
A lot of stuff you're talking about doesn't make sense.
But after a couple of months, a lot more of it is making sense.
And I know what it means now.
And it's really wonderful.
And I just never expected it.
But it's kind of like a language immersion almost.
To all those people, you're doing it the right way.
This is the way to do it.
Just keep listening.
Yeah, I totally agree the more that I think about it.
Yeah, so your pitch or your idea is that this centaur, this person who is both doing the work, but also becoming this programmer, adding a little bit of like superpower.
To what you're doing, as I like to put it, is sort of the recommended path.
And that makes a lot of sense.
I definitely agree with that one.
Now, let's dig into some of the technology that you're using.
Because some of the problems you're solving and how you're solving them, because they're really interesting.
So we talked a little bit about this flap thing and understanding its angle and its orientation.
But there's also other things that you're looking at that you're going to have to guide me a little here, because I don't know a ton about.
But there's like these stamps, like these seals, these decorative seals.
And those are like kind of like a signature or proof of authenticity of various authors and thinkers and stuff.
And so they're all over these manuscripts in very ornate ways.
And so you were trying to like discover those and also trying to actually digitize the calligraphy that I talked about.
So maybe talk us through some of the libraries you're using and just this whole analysis that you're doing, because it's really deep, like I said.
Yeah, I'd love to.
I'd love to.
Like, let's start with the stamps and seals.
So these are small little imprints that maybe some of your listeners will know what an ex libris is.
It's basically a sticker or a stamp that you place in your book, and it just says ex libris from the books of, meaning I own this book.
This book is mine.
And people in the past did that all the time, and they usually had quite lovely stamps that they placed in their manuscript to say, like, this is my manuscript.
Now, if you have a manuscript that originated in the 12th century, and it was sold often, and now it ends up in a research library, you might just have a whole history of ownership in the manuscript.
Isn't that amazing?
So you can actually trace how the manuscript traveled, not only through time, but through space.
You can see, like, oh, it was in Tabriz in the 14th century.
It was in Istanbul in the 16th century.
It was in Morocco in the 18th century.
It's like the blockchain of manuscripts.
I don't know too much about blockchain.
I'm just kidding.
Keep going.
And so I said before that OCR, that's kind of out of the question for now for manuscripts.
Yes, people are working on handwriting recognition, but it's not at any production level.
But these stamps, they are kind of ideal for OCR kind of recognition, you know.
And so, again, OpenCV is so powerful.
You have to find a very pristine example of the seal, and then, well, you give it to OpenCV, and then you just give a whole bunch of images, and you say to OpenCV, try, find me this image, basically.
And it will find seals, imprints that have a huge chunk out of them, and it will still detect them very well.
So now you can imagine if you scale this up, now if you have a couple of thousand of manuscripts that kind of belong to each other, but you don't know exactly how, now you can all of a sudden, with this kind of code, you can reconstruct the collection of an owner from the 17th century.
You can say all of these manuscripts actually belong to the same owner.
They all have the same seal.
Yeah, so you can ask really interesting questions like, show me who has ever owned, show me all the places that this person or this scholar has ever owned, and then was edited by this other person.
Or something like you can, these questions seem over many thousands of permutations, sound really difficult, but now all of a sudden now it's a, you know, a sub-millisecond database query.
This is not a reality yet, but this is what I'm working towards, and it will undoubtedly lay bare all kinds of interesting things, because then you can really see what's not spoken of, what's just kind of in the evidence.
But it doesn't make it sense.
These invisible connections that nobody has yet actually highlighted, right?
Like, all of a sudden you find that a particular kind of type of text, a text of logic, they all came through a very religious place of some kind.
Or you see that, you know, two people were constantly buying and selling from each other.
Those kinds of things you can now quite easily lay bare.
That's one thing.
Another thing is, what if you've taken, so you have 300 photos of a manuscript, meaning 300 photos in which you see a page spread.
You see two pages, basically the book opens to two pages.
And then the next photo is one page is flipped over, and so you see, you know, the next two pages, right?
What if you make it so that you only extract the ink?
You kind of have OpenCV and NumPy.
You're going to have to use NumPy for this as well.
You sort of lock on to the ink.
You delete everything.
And now you stack those layers, those very tiny sort of wafer-thin layers of ink.
You stack them on top of each other.
So now you've got 300 layers on top of each other.
And now all of a sudden you see hills and valleys, places where there's always ink and places where there's never ink.
So it's kind of like an x-ray of a manuscript.
And so the result is you see where in the manuscript there's ink, but in a way that it represents the entire manuscript, right?
It's not a representation of one page.
It's a representation of all pages together.
And so, for example, very clearly then the text block becomes visible because obviously back then they were very neat writers.
They always began at the very same place and the lining is very clear.
Yeah, that's super cool.
And you even show how in order to get some of the OCR stuff to work better, you might use OpenCV to go and delete some of the extraneous punctuation and characters and things like commas and whatnot, right?
Yeah, so now we're moving to 19th century prints.
In the 19th century, the printing press did come along in the Islamic world and they started to print.
They were very late to it.
But in the very beginning, these printed productions were quite poor in a way.
So if you just use OCR, say Tesseract, you get rubbish basically.
Is that from Google?
It's now by Google, yes.
I believe, you know, that's amazing about these things.
You know, I'm just a user of technology in a way.
And so I stumble upon a new library.
And then, you know, you quickly look into it.
It's like, oh, it's been developing for the last 20 years.
Yeah, yeah.
I just didn't know about it.
Yeah, I haven't really heard of it.
So I think it originated at HP, if I'm correct.
So it's one of the leading OCR packages.
There are other ones.
But this one works, whereas others, I can't get them to work.
So I can't invest more time in it to make it work.
Cool.
So you're basically going through and you'll like clean, you'll use OpenCV to actually clean
up and purify the stuff before you send it off to these OCR places.
So they actually have a chance of success, right?
Yes.
And really, the results are amazing, you know, because when you want to just extract the plain
text, you don't want commas because commas have been inserted by the editors anyway.
They're probably wrong.
You don't want page numbers because you can insert them digitally.
You know, you've got that under control.
So you remove all of that, you get the plain text and then to direct.
There's a really wonderful job.
This portion of Talk Python to me is brought to you by Linode.
Are you looking for hosting that's fast, simple, and incredibly affordable?
Well, look past that bookstore and check out Linode at talkpython.fm/Linode.
That's L-I-N-O-D-E.
Plains start at just $5 a month for a dedicated server.
With a gig of RAM.
They have 10 data centers across the globe.
So no matter where you are or where your users are, there's a data center for you.
Whether you want to run a Python web app, host a private Git server, or just a file server,
you'll get native SSDs on all the machines, a newly upgraded 200 gigabit network, 24-7 friendly
support, even on holidays, and a seven-day money-back guarantee.
Need a little help with your infrastructure?
They even offer professional services to help you with architecture, migrations, and more.
Do you want a dedicated server for free for the next four months?
Just visit talkpython.fm/Linode.
I don't know that people really appreciate how much work that is unless you see the original
manuscript.
Like I said, this is not a printed book, right?
This is annotated, handwritten stuff.
Yes.
I think the best way to approach this is to first find something that you can find.
Say, like I said, doing sort of the x-ray analysis, now you kind of know where text ought
to be.
And so then you can use that knowledge and come back to one image and analyze that one image
with that knowledge of where the text ought to be.
And so now if you find ink outside of those text blocks, then you know, oh, there's a
marginal note.
This might be interesting.
Right.
Maybe that's the most interesting part, right?
But you want to capture it separately.
You can't just like try to cram it together or whatever.
Yeah.
How interesting.
It's got to be inspiring to a lot of people to just see all of this cool technology being
applied to stuff that I suspect it was not initially designed to be applied to.
And things that when I first look at it, like I don't really know how much technology is
going to directly answer these questions.
But this idea of saying like I'm going to create like an ownership chain in say a graph
database or something like that of these Vanish scripts and use that to explore these hidden
links.
That's really interesting.
I think it's unexpected and very cool.
Yes.
But there are a lot of challenges ahead of us.
Okay.
Yeah.
What are some of them?
To start with the data that we need is not accessible right now in the way that we would
like it.
Right now, digitized manuscripts are often just on a website of a university library.
You can only kind of look at them with your human eyes, right?
But you can't access them with an API.
So you can't just sort of programmatically bring them in.
So this really lost opportunity.
But, you know, I'm working on it.
I'm talking a lot with librarians.
So hopefully we'll see some of those there.
That's really cool.
You know, sometimes when there's not an API, there is.
It's just not intended.
Right.
Like there's Selenium or there's Beautiful Soup and requests or right.
There's ways to go through and actually extract that data, even if it wasn't prepared to be
presented in that way.
You know, how much is that possible?
And how much are there like licensing or usage restrictions that make that kind of research
impossible?
Well, the sort of the licensing copyright issue is murky territory at the moment.
So this is also something that needs to be worked out.
But you're right.
I mean, this is, of course, possible.
Yeah.
But you don't want to go through and like grab all this data and say, well, you can't use
any of it because you're going to be in trouble for X, Y and Z.
Right.
Yeah.
In these kinds of fields, the world is very small, you know, so you can't make enemies.
Yeah, of course.
You might be able to make proof of concepts, though.
Right.
Like maybe as a research, like a young grad student or something, you could say, well, if
I had this data, what questions could I ask and answer?
And then maybe do something and present it back to that organization.
Say like, look, if you would somehow provide us this information, like these are the types of
things that we can do.
We spend a week to show you how can we help make that happen.
Right.
That's right.
I feel like I myself, at least I'm building up towards that.
I've already been saying these kinds of things to libraries.
And perhaps after this project, I might just be able to do like a full DH project, so to
say, and really come at this with full force.
That's the other challenge for us in the humanities.
Like we can't spend all of our time on programming.
We can't spend all of our time on these kinds of things.
So we have to divide our time and always make this difficult decision, like how much of my
personal development is going to go into this.
And if I stumble upon the problem that I can't just fix with Google and Stack Overflow, then...
Was it a dead end that like wasted your tenure track possibilities or something like that,
right?
So you don't want to change that.
Yeah.
So in the harder sciences, we have the Journal of Open Source Software.
Are you familiar with this?
I wasn't until you showed this to me.
Yeah.
So I had these folks on the show a while ago and it's pretty interesting.
It's a place to publish and cite the software side of your research.
And I did say it was more for the hard sciences, but it sounds to me like the stuff that you all
are doing in your community would also be potentially something you could publish there and then cite as
some kind of publication and whatnot.
So maybe that's a little bit of a release valve to get a little bit more credit for the software side of
things.
Definitely.
Because our main challenge is that much of our exactly, like you said, tenure track career wise,
it kind of still depends on print publications and building software kind of doesn't count,
it seems, right?
Yes.
Very difficult for us.
Yeah.
But there have been discussions about this where people in digital humanities have been
saying, well, actually we're builders, we're not writers.
We should just come to terms.
Yeah.
It's not a unique problem to digital humanities, but it is, I can imagine, a little bit harder
there.
Yes.
Because let me ask you this, like the one very sort of one problem that presents itself is
that every piece of software is kind of unique.
So how are you going to compare it with other pieces of software?
How are you going to say like, oh, this is very good or this is not so good.
This is good enough for to make tenure or this is bad enough to fire him.
Yeah.
I have no idea how to do that.
That is really tricky.
I see the problem.
Yeah.
Interesting.
Now, we're getting kind of short on time here, but I do want to give you a chance to talk about
your two new projects or your book.
You have a book called Among Digitized Manuscripts and another one, a project that you're thinking
about called Digital Literacy.
Do you want to touch on those real quick before we wrap things up?
Sure.
Thank you.
So over the last two years, I've been really focused on digitized manuscripts and how to
incorporate that into a workflow.
And out of it came this handbook, which I called Among Digitized Manuscripts.
You can go to github.com/among and you will find the repository and find some more
information about it.
It's basically a conceptual and practical toolkit for those who want to work with manuscripts
in a digital file format when they're looking at digital photos.
And so it's a very broad discussion about the concepts of it, about the challenges, but
also a whole range of tools.
So we're starting just with how to make vector images, which is a crucial skill to have.
If you can replicate glyphs from manuscripts in a vector format, you can manipulate them much
easier on a computer, of course.
And then we go up until a chapter that really introduces Python.
And I go through this example of measuring the angle of the flap and really go through
that entire code and explain it step by step what we're doing here.
All the while, of course, pointing out to people that if they want to really know more about
Python and JavaScript, which I also cover, then there are plenty of resources on the internet
or in other books available to do that.
So it's also to really to get people who are not yet in, who are not familiar with technology
to get them up and running.
Okay.
Yeah.
That sounds really interesting.
And I'm sure it's a pretty unique book.
There's probably not that many books on digital manuscripts and Python.
So it sounds like it's going to be a good resource for people.
I don't want to pat myself on the back here.
Yes, it's a virgin field.
So, you know, I would say to others, you know, really need to think through these problems.
These problems and push things further.
Yeah, absolutely.
And then the other one, digital literacy.
Well, yes.
This is sort of a concern of mine that I've had for many years.
And it's sort of part of the reason why I started the digital orientalist.com sort of online
magazine about how to use computers in your day to day workflow as somebody in Islamic studies
and in neighboring fields like Synology, Japan studies, Africana, etc.
I kind of feel that a generation before me and perhaps also my generation, I'm in my early 30s.
We still grew up with computers as something that you had to kind of make work.
Otherwise, it wouldn't do anything.
And people even before that, they didn't grow up with computers.
They don't know what's going on basically.
But people younger than us, they're growing up now with all of this, you know, polished technology.
It's just a black box basically.
And I'm kind of worried that people don't really get to understand exactly what really the foundational concepts of computers,
how knowledge is stored on a computer in bits and bytes.
It might not, you know, it might not come up on a daily basis.
But knowing this, I think, is very important in handling computers well and understanding
how computers are also used at scale, of course, by governments and whatnot.
Yeah.
Well, I definitely think that the world is absolutely full of consumers of technology.
But there's definitely room for more producers or creators with technology, right?
That's right.
I feel that in the humanities, we ought to be self-sufficient and self-reliant.
And if we can use some of programming skills ourselves, we can already solve, you know, 90% of our problems.
Yeah, absolutely.
Yeah.
Programming is a superpower for whatever you're doing.
That's for sure.
All right.
Well, I think we're going to leave it there for the main topic because we're out of time.
But before you get out here, let me ask you the last two questions.
So if you're going to write some Python code, do some of this cool image analysis, what editor do you use?
I use PyCharm CE.
Yes.
Yeah.
I just like it.
I've been using now.
I've been getting into Jupyter Notebooks, actually, thanks to your podcast with the Azure Notebooks episode.
Because I'm working on a workshop in the fall for PhD students.
And I was not planning on installing Python and pip on 30 machines.
So this is the way to go for that thing.
Yes.
Yeah.
I think it's great for teachers and for running classes and workshops.
It's just open a browser, go here, you're ready.
Yeah.
It's not like, well, it won't install this package on my computer.
Like, oh, no.
Here we go.
So, yeah, that's great.
Excellent.
And then notable PyPI package.
It sounds like you've got some interesting experience and exposure to them.
Yes.
Well, I mentioned OpenCV, of course.
Something that you can manipulate PDFs is PyPDF2.
Something I've been using, in my experience, there's a lack of, or there's really a need for more libraries handling PDFs.
I don't know how it's in other fields, but in the humanities, PDFs are very important file format.
A lot of information is contained just in PDFs.
So I hope we'll see more development in that.
For image, like drawing and manipulation, you're also going to need something like Pillow, which is a fork, I believe,
the Python imaging library.
Beyond that, I'd also like to mention that TextFabric.
You can pip install Text-Fabric.
And that's really just for analysis of a text that you have in plain text format.
I myself work with a developer to get the Quran in the TextFabric format, so to say.
And you can do real deep, like syntactic or semantic analysis.
And kind of just outside of sort of the Python ecosystem, I also use something.
It's called Pandoc.
And it's incredibly useful for me.
So it's a command line app.
You can reinstall Pandoc.
And you can change from one file format to another.
And for example, in my case, when you have different kinds of scripts, like English and Arabic mixed in, and you've got footnotes and endnotes and all of that.
And you've got it in a Word doc.
And Word is horrible, of course, to do anything with.
And you want to go to just plain text.
Yeah.
It's amazing.
Yeah.
I hadn't heard about that, really.
I haven't used it anyway.
And it looks super cool.
Like, it'll convert to and from OpenOffice, Microsoft Doc, RestructureText, Markdown, all kinds of stuff in here.
That's great.
Mm-hmm.
Yeah.
And then also on our shared notes, you have this Mac app that I'm pretty excited to try out called GoToShell.
You know, it's a good example.
GoToShell.
So it's macOS only, and it sits in your Finder.
And if you're in a folder, just a little button at the top, like in the toolbar, you click it, and a terminal opens, and you're immediately in that folder.
Yeah.
In the terminal.
It's these kinds of things that are tremendously important for me as just a scholar who's, yes, I program, but I understand that some others would, you know, would sort of scoff at this and say, like, oh, no, the only right way to do that is to open a terminal and, you know, CD into it.
No, no, this is cool.
It's easy for me, you know?
Yeah, a lot of times you're in a terminal or a Finder, and you're like, I just want to go here, but how do I copy here?
There are some tricks that are absolutely not obvious.
Like, you can go to the file of the folder, either one really, but let's say the folder, and you can command C it, and then you can command V that into a terminal window.
But it's just like push a button.
It opens the terminal in the right place.
That's cool.
I'm going to check this out.
There you go.
Yeah.
All right.
Well, that's pretty much it for our time.
Final call to action.
Maybe speak to the folks out there doing humanities research or maybe not even using the digital side of things yet.
How do they get started?
Exactly.
Well, so if you're listening in the humanities and you want to, you're interested, you want to, you want to go for it, just, you know, keep listening to podcasts like this.
Pick up my book if it comes out later this year and come in contact with me.
You know, there's sort of a network at digitalorientalist.com where you can also share your experience.
I'd be very happy to help you get along.
And this also sort of kind of crosses both ways.
If there are Python developers out there who kind of think like, oh, this would be so exciting to work on humanities projects.
There are all kinds of project ideas that I just have, you know, but I can't do anything with them because of limited time then.
So connect with me and be very great to, you know, see things go forward.
Yeah, absolutely.
Well, Cornelius, I really love this look into what you're doing and I think it's fascinating how all these pieces are coming together.
So thanks for taking the time and being on the show.
Thanks to you and the community for making Python what it is.
That's what I would say.
Absolutely.
All right.
Well, talk to you later.
Thanks.
All right.
Bye.
This has been another episode of Talk Python to Me.
Our guest in this episode was Cornelius Van Litt and it's been brought to you by Command Line Heroes and Linode.
Command Line Heroes is a podcast telling the story of developers.
This season is all about programming languages and starts off with Python, of course.
Subscribe at talkpython.fm/heroes.
Linode is your go-to hosting for whatever you're building with Python.
Get four months free at talkpython.fm/Linode.
That's L-I-N-O-D-E.
Want to level up your Python?
If you're just getting started, try my Python Jumpstart by Building 10 Apps course.
Or if you're looking for something more advanced, check out our new async course that digs into all the different types of async programming you can do in Python.
And of course, if you're interested in more than one of these, be sure to check out our everything bundle.
It's like a subscription that never expires.
Be sure to subscribe to the show.
Open your favorite podcatcher and search for Python.
We should be right at the top.
You can also find the iTunes feed at /itunes, the Google Play feed at /play, and the direct RSS feed at /rss on talkpython.fm.
This is your host, Michael Kennedy.
Thanks so much for listening.
I really appreciate it.
Now get out there and write some Python code.
Thank you.