I love what I do
I’m a developer. I write code that does things. I also have to do a lot of design. Sometimes I’m designing visual items - like icons, logos and buttons. But I spend most of my thinking time not on the way things look, but on the way things should work.
This morning I’m exploring how to store a sentence and its translation in a data structure that a computer program can understand. I have the same sentence in English and French:
There is no easy road.
Il n'y a pas de route facile.
What I need is to represent the connections between these words. For example,
There is no => Il n'y a pas de easy => facile road => route
But you’ll see that the word order is different - it’s route facile
or road easy
. So what I need to do is to represent the idea that these chunks of a sentence, or tokens to use the linguistic term I’ve just learned, are reordered in a whole sentence.
I think what we’ll end up with is a piece of data like this:
sentence = {
tokens: [
{
id: 1,
english: 'There is no',
french: 'Il n'y a pas de',
},
{
id: 2,
english: 'easy',
french: 'facile',
},
{
id: 3,
english: 'road',
french: 'route',
}
],
english_structure: [1,2,3],
french_structure: [1,3,2],
}
This might work, and it might not. So I’ll start with this idea and explore it for a while. I’m sure I’ll come up against problems - off the top of my head I can see trouble with punctuation like commas and full stops. I can also immediately foresee problems with verbs that are wrapped:
``` He doesn’t like it. Il ne l’aime pas.
Il => He ne l’aime pas => (he) doesn’t like it. ```
That’s not ideal. We really want to subdivide this sentence so that it is explained more clearly:
Il => He
ne ... pas => doesn't
aime => he likes
le => it
So more thought is definitely needed!
I really enjoy the variety of things that I work on. Last week I developed a system to convert animated GIFs into video files. This past weekend I wrote a quick program to extract the most recently restaurants from Foursquare in my home city. All these things are like little puzzles that teach me something new along the way. It’s wonderful.