On 3 February 2013 20:00, Bernard Chardonneau <[email protected]> wrote:
> It works, but with something strange for <b pos="1"/>
> There is an execution error for the second rule, but <b pos="0"/>
> works for it.
>

The error is because there is no source space -- spaces only exist
_between_ source words. Just use '<b/>' when you want to insert a
space where none had previously existed.

> More simple : the tag <b /> works for the 2 rules.
>
> So, what means pos="1" (or another value) inside <b .../> tag ?
>

It inserts the superblank that follows the first word. This is
important for superblanks -- things which have been "commented" in the
text stream -- because they will be discarded otherwise. In other
words, what the rules are told is a space may, in fact, be HTML, etc.

So if the input stream is:

^foo<bar><baz>$[<some-html>]^frobnitz<baz><bar>$

in a rule that matches 'foo' followed by 'frobnitz', '<b pos="1"/>'
equals '<some-html>'. If the rule matches 'foo' only, transfer handles
that superblank itself, so there is no '<b pos="1"/>'.
number_of_blanks = number_of_pattern-items - 1

The other case, that you haven't encountered, is what to do when a
"space" is deleted -- when two words are merged into one, etc. In this
case, it's best to copy the f_bcond macro from one of the other sets
of rules, and call it _after_ the text has been output. (If the space
that would otherwise be deleted had included something other than a
space, it will be output after the rule's output; if it's just a
normal space, nothing is output).

-- 
<Sefam> Are any of the mentors around?
<jimregan> yes, they're the ones trolling you

------------------------------------------------------------------------------
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://p.sf.net/sfu/appdyn_d2d_jan
_______________________________________________
Apertium-stuff mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/apertium-stuff

Reply via email to