This section contains indications on how to access the SVN [1] and a doctest generated code documentation.
SVN is a tool used by many software developers to manage changes within their source code tree. SVN provides the means to store not only the current version of a piece of source code, but a record of all changes (and who made those changes) that have occurred to that source code. Use of SVN is particularly common on projects with multiple developers, since SVN ensures changes made by one developer are not accidentally removed when another developer posts their changes to the source tree.
In order to access a Subversion repository, you must install a special piece of software called a Subversion client. Subversion clients are available for most any operating system. You can check out the code through SVN with the following instruction set:
Syllable and syllabification Tool
This class defines a phonological segment.
>>> segment = PhSegment(['p', '1', 'O'])
It is made of the segmental phonological representation
>>> print segment.segment
p
The sonority of the segment
>>> print segment.son
1
The natural class (O=Occlusives, F=Fricatives, V=Vowel etc.)
>>> print segment.pclass
O
The CV node, which defines whether the segment is (C)onsonat or vowel (V)
>>> print segment.cvcv
C
Core syllabification module.
Return a phonological segment or an option from the sonority file. The sonority file to be used is specified in self.lexicon.
>>> syl = SylModule()
>>> syl.fetch_lexicon('a')
'a, 22, V'
>>> syl.fetch_lexicon('output', section='General')
'str'
The transducer can perform only two operations: Ship and Translate. Translate converts a string into the corresponding phonological object Ship, ships a translated sequence to the Syllabification Algorithm.
>>> syl = SylModule()
>>> for seg in syl.input_transducer('io'):
... print seg.segment, seg.son, seg.pclass
i 22 V
o 22 V
Load $HOME configuration file sonority.txt. It first looks if $HOME/.sylli is already there, if not it creates it. It then set the attribute self.sonority_file (sonority filename) and self.lexicon (ConfigParser object).
>>> syl = SylModule()
>>> syl.load_conf('config/sonority.txt')
True
The class method also sets most class attributes
>>> print syl.output, syl.extra
str 1
Segments, sonorities, natural classes and syllable boundaries are flattened into one dimension ready to be printed in a sequential, phisical form.
>>> syl = SylModule()
>>> psequence = syl.input_transducer('kasa')
>>> syllabified = syl.sa(psequence)
>>> syl.output_transducer(syllabified)
'ka.sa'
Divide a phonematic sequence into syllables. The sequence is list of phonological objects. Each object is evaluated using an extremely simple syllabification algorithm based on the Sonority Sequencing Principle. It puts a syllable boundary after every minimum, or when two consequtive sonorities are equal
>>> syl = SylModule()
>>> ph_sequence = syl.input_transducer('io')
>>> for seg in syl.sa(ph_sequence):
... print seg.segment, seg.son, seg.pclass
i 22 V
o 22 V
It goes through the three sub-modules/methods of the class. First it transduce the sequence, then it ships it to the SA and finally to the output transducer. The main method of the class.
>>> syl = SylModule()
>>> syl.syllabify('kasa')
'ka.sa'
strip out TIMIT off a file.
>>> detimit('test/files/sample.std')
['__', 'ma%', '%"io', 'nO', 'tSe', 'l-"O', 'la', 'farf"alla']
Return a dictionary of the form filename:content of a directory
>>> dirl('test/files/')
{'test/files/sample.std': ['__ ma% %"io nO tSe l-"O la farf"alla'],...
You can specify a file extention, in this case, only files with such extension will be parsed.
>>> print dirl('test/files/', ext='std')
{'test/files/sample.std': ['__ ma% %"io nO tSe l-"O la farf"alla']}
Return a a list of string with the content of a file, if it is a TIMIT, it stript the TIMIT off.
>>> filel('test/files/sample.std')
['__ ma% %"io nO tSe l-"O la farf"alla']
Run the command line script.
Note that Sylli always requires an argument.
>>> main(argv='')
sylli: use at least one argument...
The simplest way to use Sylli is to syllabify a string
>>> main(['-s', 'la kapra'])
la.ka.pra
You can also syllabify a timit file, which will be parsed as single string.
>>> main(['-f', 'test/files/sample.phn'])
no.na.i.u.na.farf.fal.la.al.lo.ra.swo.pra.la.mi.a.mak.kji.ni.nab.blu
Or a text file. The lines are feeded into sylli one by one.
>>> main(['-f', 'test/files/sample.txt'])
O.vis.to.u.na.vol.pe.ne.ra
trop.pes.tel.le.bril.la.no.in.tSE.lo
or a directory:
>>> main(['-d', 'test/files'])
ma.i.o.nO.tSe.lO.la.far.fal.la
O.vis.to.u.na.vol.pe.ne.ra.trop.pes.tel.le.bril.la.no.in.tSE.lo
no.na.i.u.na.farf.fal.la.al.lo.ra.swo.pra.la.mi.a.mak.kji.ni.nab.blu
You can also run a demo of the program
>>> main(['-z'])
<BLANKLINE>
Frequent clusters:
pane -> pa.ne
OLLo -> OL.Lo
...
Other options allow you to print the current version
>>> main(['-v'])
sylli-0.9.8
Copyright 2010 Luca Iacoponi...
Or the help screen
>>> main(['-h'])
Usage: sylli [OPTION]... [FILE|string]...
Sylli will automatically look for the sonority.txt in your $HOME. But you can always use another configuration file. Remember to use -c option before any other.
>>> main(['-c', 'test/crazysonority.txt', '-s', 'papa'])
p.a.p.a
Finally, you can run sylli in interactive mode.
>>> main(['-i'])
Restore installation sonority overwriting current sonority
Return usage help.
>>> print usage()
Usage: sylli [OPTION]... [FILE|string]...
Divides a file, a string or a directory into syllable....
Return the version of the program and other information
>>> print version()
sylli-0.9.8
Copyright 2010 Luca Iacoponi...
a cross-platform way to get user’s home directory
Get config dir on Windows
>>> get_config_dir()
C:\Users\nijan\AppData\Roaming
Get root directory of a env var
>>> get_dir_root('${HOME}')
'/home/alice'
Get home directory
>>> get_home_dir()
'/home/alice'
Get a path of a specific sylli’s location
>>> get_path('config_dir')
'/home/alice/.sylli'
>>> get_path('inst_sonority')
'/home/alice/Sylli/sylli/config/sonority.txt'
>>> get_path('usr_sonority')
'/home/alice/.sylli/sonority.txt'
>>> get_path('images')
'/home/alice/Sylli/sylli/images'
UI for Sylli
Frame for the Content window
Create the wxApp object which contains the main frame and show it.
Initialise the application
Create a drop target. It adds to a form the filenames of the files dropped in.
Main frame. Includes the icon, menu bar, help bar, status bar and the two panels: one with the widgets, the other with the control for the sdout/stderr text.
A wx about box.
A wx frame showing the program documentation
Edit the current working sonority file
Load an alternative sonority file
Update the status bar sonority
Create a new sonority file, using installation sonority as a template.
Quit, destroy the main frame
Restore installation sonority.txt by copying it into user’s home
Set a new sonority file as the one in use in UI and SylModule.
Creates the help bar.
Create a menu of the menu bar.
Get the data from menudata() and create the menu bar.
Show an error dialog.
Return data to be included in the menu bar.
Update all widgets to reflect the SylModule attribute values.
Create an html Window for displaying the documentation
Main panel of the program, it contains all the widgets.
Run the demo module demo, showing syllabification examples.
Quit, destroy the frame
Set working sonority (which may have been edited or changed) as SylModule sonority,
Create a button.
Contains the data of the three buttons on the bottom
Create the three buttons on the bottom of the panel
Create a note tab panel
Show a dialog to choose the directory to syllabify
Show a dialog to choose the file to syllabify
Redirect the stdout/stderr output to a wx text control.
Create an open file dialog.
Return one of the png in images/ as a bitmap object
Return one of the icon in images/ as an ico object
Run the application. Create a wx.App object and run MainLoop method.
Create a save file dialog.
Syllabify files in the list
Write in file $filename a content $content