Thursday, July 06, 2006

[LinkGrammar4R] We need higer-level API?

Thank Bradford Folkens for reporting the bug that sometime LinkGrammar4R just crashes when Linkage.new is called. It occurs since there is no linkage from parsing result. Thus, in Linkage.new, the index was checked before calling linkage_create. If the index is out of range, the exception will be raised.

However, I feel like LinkGrammar4R need more higher-level API that free us for checking these index. It may be an iterator?


iterateLinkage(sent, opt).each{|linkage|
.....
}

or

parsedSentence.eachLinkage(opt) {|linkage|
......
}

2 comments:

Anonymous said...

Vee, thanks for working through that bug in less than a few hours! lol

Great idea for more interface designs, and yes - I think we need some sort of way to interface better with a parsed sentence. The OO approach that is currently used isn't bad, but Ruby provides such beautiful iterators that it'd be a shame not to utilize them in a more complete way.

Maybe something like:
parsedSentence.linkages.each

... could work as well (in addition to your ideas)...

veer said...

It was filed as feature request here