source: orange/Orange/doc/reference/basket.py @ 9671:a7b056375472

Revision 9671:a7b056375472, 866 bytes checked in by anze <anze.staric@…>, 2 years ago (diff)

Moved orange to Orange (part 2)

Line 
1# Description: Reads a basket file
2# Category:    file formats
3# Classes:     ExampleTable
4# Uses:        inquisition.basket, inquisition2.basket
5# Referenced:  fileformats.htm
6
7import orange
8
9print "Sentences in 'inquisition'"
10##data = orange.ExampleTable("inquisition")
11##for ex in data:
12##    print ex
13##    print
14
15data = orange.ExampleTable("inquisition2")
16for ex in data:
17    print ex
18
19# This is to make the regression test independent of the system
20# and the version of Python
21def printSortedMetas(metas, nm=0):
22    l = metas.items()
23    if nm:
24        l.sort(lambda x,y: cmp(x[0].name, y[0].name))
25    else:
26        l.sort(lambda x,y: cmp(x[0], y[0]))
27    print l
28   
29example = data[4]
30printSortedMetas(example.getmetas())
31printSortedMetas(example.getmetas(int))
32printSortedMetas(example.getmetas(str))
33printSortedMetas(example.getmetas(orange.Variable), 1)
Note: See TracBrowser for help on using the repository browser.