[CWB] Make 'cut' treat ranges like 'cat'?
Martin Hammarstedt
martin.hammarstedt at gu.se
Sun Nov 12 18:15:48 CET 2017
/ > > cut Last 5 15 > Oh, I wasn't aware that this variant of the cut
command exists at all. Where did you find it?/
It's mentioned on page 19 in the CQP tutorial (http://cwb.sourceforge.net/files/CQP_Tutorial.pdf).
/ > My suggestion would be to > 1) disallow negative values for <A> and
<B> as indices from the end – or does anybody actually use them?/
As far as I can tell the current implementation of negative indices is broken:
if (first < 0) first = n_matches - first;
if (last < 0) last = n_matches - last;
Since first/last are negative numbers, the subtractions above result in additions, so index -3 in a query with 10 results actually translates to index 13, leading to an error. I guess that means you can safely assume no one has been using the negative indices.
/ > 2) clamp the specified range to the query size, possibly issuing a
warning if start or end are out of range/
Sounds good to me, as long as it also means that we get an empty result when both start and end are out of range (just like with 'cat').
Martin
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://liste.sslmit.unibo.it/pipermail/cwb/attachments/20171112/b28ff2c6/attachment.html>
More information about the CWB
mailing list