[Clam-devel] Re: Patches for python session

David García Garzón dgarcia at iua.upf.edu
Sat Jun 28 11:25:54 PDT 2008


On Dissabte 28 Juny 2008, JunJun wrote:
> > What it is missing:
> >  - The 'DeeperTag' should be 'Segmentation', see the xml you are getting
> > on the unit tests
> >  - You should move the size attribute from AttributePool to the
> > Segmentation element. Be careful as the ScopePool has a different 'size'
> > attribute. The one to be moved is the one on AttributePool.
>
> What about the original size attribute of AttributePool? Below is my
> current way to move it:
>
>     ......
>     line2.attrib.clear()
>     line2.set('name', attribute)
>     ........
>
> If there is any better way to clear a special attribute, please tell me.

This sentence:
size = line2.attrib.pop('size') 
returns the value and removes it from the dict

You can see the available methods for a dict in:
http://docs.python.org/lib/typesmapping.html
or just by doing   help( {} )


> > - We should decide what to do with maxPosisiton and the like. By now
> > ignore it until you get the problems. We could provide or compute the
> > wave size by command line params.
>
> OK

Some additional points:

The same way you set the text you can get it, no need to 'find':
anElement.text = anotherElement.text

And the name of the outer tag now will not be not 'Segmentations' 
but 'AttributePool'.

<?xml version='1.0' encoding='utf8'?>
<DescriptorsPool>
  <ScopePool name="Song" size="1">
    <AttributePool name="Silences" size="3">0.1 0.2 0.3</AttributePool>
  </ScopePool>
</DescriptorsPool>

Should turn into:

<?xml version='1.0' encoding='utf8'?>
<DescriptorsPool>
  <ScopePool name="Song" size="1">
    <AttributePool name="Silences">
       <DiscontinuousSegmentation maxlenght="1000" size="3">0.1 0.2 
0.3</DiscontinuousSegmentation>
    </AttributePool>
  </ScopePool>
</DescriptorsPool>


-- 
David García Garzón
(Work) dgarcia at iua dot upf anotherdot es
http://www.iua.upf.edu/~dgarcia
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.clam-project.org/pipermail/clam-devel-clam-project.org/attachments/20080628/76097d99/attachment-0003.pgp>


More information about the clam-devel mailing list