[KDE-Sonnet] [lingu-dev] Introductions from the KDE guy

Kevin Scannell kscanne at gmail.com
Thu Jan 25 21:49:04 CET 2007


Ar Déardaoin 25 Eanáir 2007 13:07, scríobh Daniel Naber:
> > i.e. fromx,tox,fromy,toy, or else it becomes more or less impossible
> > to write the vim plugin using the API, since moving around the
> > document is based on lines/cols.    I decided to not include a global
> > byte offset since it can be computed from the lines/cols if need be.
>
> One might need to be aware of the different line endings on Unix/Windows
> (\n vs. \n\r) for that.

Yes, good point.  How one handles this affects the definitions of
fromx, fromy, etc., so we should put in a word about it in the 
API documentation.   I currently treat "\n" _or_ "\n\r" as the boundary
between lines for computing the line numbers, and these 
characters have no effect on the column numbers.
The important thing to me is this - if a file "a.txt" has DOS line endings,
then the results of

$ cat a.txt | gram-ga.pl --api

should be the same as if you first strip the DOS line endings:

$ cat a.txt | tr -d "\015" | gram-ga.pl --api

> > (2) The other way of locating the error is within the given "context"
> > string (what is currently called "sentence").    This could either be
> > done with an offset counted from the beginning of the context string (as
> > I've done),
>
> Okay. What do you think of dropping "errortext", as it duplicates
> information you have anyway from contextoffet  + context, doesn't it?

Almost.  The one thing that's missing is the length of the error itself,
as measured in the context string.  You might try and compute this by
counting characters between (fromx,fromy) and (tox,toy) in the original
document, but that will count markup characters, repeated whitespace, etc. 
that
Gramadóir strips out to get the "context" string.  

  I'm now seeing the appeal of putting your "<marker>" tags into the
"context" attribute, and getting rid of contextoffset entirely.
I'll go ahead and do that.

Thanks again for your comments

-Kevin



More information about the kde-sonnet mailing list