Thursday, December 10, 2009

Hyper-hyponymizer / wordnet tree PostMortem

So after all that the Hyperhyponymizer is complete. It did go through a few different iterations in the process though. The first change was a major one. When we realized that we might end up dealing with some very large datasets (70 + words at times) we thought it would be best to discard the current gui in exchange for a new one which could present the words in more of a list format. We settled on trying to create animated Bezier curves for this, which I did actually get working:
the animation of these curves was fairly simple. I used the cubic bezier equation like this

for(var i:uint = 1; i <= 70; ++i){

t = i/70;

Y = (ap1.y * ((1-t)*(1-t)*(1-t))) + cp1.y * (3 * ((1-t)*(1-t))) * t + cp2.y * ( 3 * ((1-t) * (t*t)))+ (ap2.y * (t*t*t));
X = (ap1.x * ((1-t)*(1-t)*(1-t))) + cp1.x * (3 * ((1-t)*(1-t))) * t + cp2.x * ( 3 * ((1-t) * (t*t)))+ (ap2.x * (t*t*t));

curve.graphics.beginFill(0xFFFFFF, 0.1 + i/70);
curve.graphics.drawCircle(X, Y, 1 + (2 * ((70 - i)/70)));

}

This is actually a really beautiful and useful mathematical equation. It was a bit tricky to find a version of it I could use in flash. I ended up adapting this one from one I found on a C++ forum. Basically cp1, cp2, ap1, ap2 are Points representing anchor points and control points. Bezier equations are different from other types of functions in that for a single 'y' value there can be multiple 'x's and vice-versa, so a new value 't' is used as the independent variable (t is between 0 and 1 (this is important!)). To draw the curves here I simply used a for loop with 'i' being used as 't'. This worked well, but did not animate the curves (obviously). To animate them I just exchanged the 'for' with an ENTER_FRAME eventListener, so that a new circle was drawn for each new frame, up until a certain number of frames. This worked, but not perfectly, because any change in frame-rate affected the speed of the growth of the curves. The next thing I tried was to exchange the enter_frame with a TweenLite tween, drawing a new circle everytime the tween was updated to a new frame. This fixed the speed problem but created a new one. Because of the (admittedly flawed) drawing method, whenever there was a drop in the framerate there was a gap in the curve:
because we were running out of time, and the Bezier curves were turning out to be a major headache (as well as the fact that I don't think they would have looked as good) we decided to switch back to the original interface. There were a few bumps in the road in adapting it to the backend, but it didn't take too much to get them working together:


and a little tip here: Always check where the borders on your textfields are! (make sure they don't look like they do below!)



and just because they look nice, another (accidental this time) bezier-curve drawing:

Friday, December 4, 2009

increased efficiency

so I've had this nagging feeling that I might have some efficiency problems in this thing, and I suspect that it has to do with the lines that connect nodes. I started suspecting them because every now and then I notice little dots like you see below, and the only place I can see them coming from is connections that are not being deleted properly.

so I added a text field to print out the number of children that the line 'layer' has, and low and behold:

seems like I'm getting 8 for the price of one... I have a good idea where this is coming from though. Oh and I should also mention that when you navigate backwards only one child is removed (not the 8 that are created)

Thursday, December 3, 2009

progress update

so the gui is in the final stages of completion (I believe)
I put up a demo of it here





and here's a little tip for everyone: If you are using textFields as buttons, and they're acting weird, make sure they are not overlapping each other like this, or you will have weird problems!

well...

that was easy. Commented two lines of code and it works basically perfectly. sweet!

Wednesday, December 2, 2009

where it's at

Just a little update before I get started for the day. So last night I fixed a lot of messy little things that were bothering me a lot. I've got the alpha of the textfields tweening up and down when they are created and removed, which stops them overlapping each other weirdly before they are removed. I've also changed the way text fields are dealt with internally, before I was creating, formatting and entering text in them and then adding them to their Nodes, as well as having an event listener that moved them every frame whether their Nodes were moving or not. It was very bad and messy, but now I have them created and formatted within the constructor of each Node, with their positions updated only when Node's are being created or removed, much nicer, much cleaner. I've also fixed a problem where the rotation layer would rotate 350º when it should have rotated 10º, or 358º when it should have been 2º (etc, etc). This problem was occurring because destination angles were being set by the angle property of each node, and because if I tell flash to go from 355º to 5º it won't go over the top of 360º to 0º and then to 5º from there, it goes down through every angle between 355º and 5º making a weird dissorienting spin. I fixed that by changing the way destination angles are being set. I'm know just increasing the rotation by the difference between the angle of the current node clicked and the previous node clicked, which seems to work perfectly. I also moved the 'camera' so that the most recently created layer of children Nodes are more central on the screen.

anyway, jsut a little summary, today I plan on fixing the biggest, worst and last bug I have right now, which is that when you delete children and then try to grow them back from their parent, you get a big runtime error, and everything gets all screwed up. I'm hoping that there will be some quick fix for this, but I guess we'll find out soon...

once that's cleared up I want to make an additional text based navigation system/control panel, so hopefully we'll be seeing that by the end of the day...

Monday, November 30, 2009

Tree Navigation Workin' (mostly)

SoI've spent some time fighting with flash, but I've got this tree/node navigation thing mostly functional. Click a node and it sends out all of that node's children (to eventually be determined by XML), click a sibling of the original node and that siblings children will come out as the others go back in. Click a parent and all of the parent's descendants are removed. It has some serious bugs at this stage, but I'm really happy for the most part. Anyway, updates should be imminent, working demo and source are here

Friday, November 27, 2009

update and SWF that works AND source

for any interested parties, the tree-drawer now works in Camino, firefox and what-have-you on mac, and I've put up the source code as an added bonus.

(of course, it works on windows too (as far as I know) )

here's some pretty pictures: