On 3/6/2014 9:21 AM, Terry Brown wrote:
On Thu, 6 Mar 2014 02:16:33 -0800 (PST)
Fidel N <[email protected]> wrote:

Is there a reason why UNL's don't keep the number of nodes with the
same node inside its string?
Same way as xPath does?     "Node name [number]->> Node
name[Number]-->"
Only that multiple same name nodes hasn't come up enough for it to get
implemented, but it's a good idea.  I'm thinking it's not worth trying
to find a syntax which avoids breaking with nodes called "foo[7]", they
can't be that common and we don't avoid breaking on nodes called
"foo-->bar", so might as well keep it simple.

So I would propose the syntax is simply [N] appended immediately after
the node number

so

import re
pos_pattern = re.compile(r'\[(\d+)]$')

and then while processing each level of the UNL

unl_part = 'test[22]'
pos = pos_pattern.search(unl_part) or 0
if pos:
     pos = int(pos.group(1))
     unl_part = pos_pattern.sub('', unl_part)

and search the current node for the pos'th child called unl_part

Cheers -Terry


Perhaps an even more uncommon character could be chosen? Such as ‡N‡ ?

Just a thought.

-->Jake

--
You received this message because you are subscribed to the Google Groups 
"leo-editor" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/leo-editor.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to