Skip to content

Latest commit

 

History

History

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 

Reading and Writing CLDF Wordlist Data with LingPy

Exporting LingPy's wordlist format to CLDF is straightforward:

>>> from lingpy import *
>>> from lingpy.tests.util import test_data
>>> from lingpy.convert.cldf import to_cldf, from_cldf
>>> wl = Wordlist(test_data('KSL.qlc'))
>>> to_cldf(wl)

Similarly, reading a wordlist, is as straighforward as pointing to the metadata-file.

>>> wl = from_cldf('cldf/Wordlist-metadata.json')

This makes it also possible to convert quickly from CLDF to Nexus and a couple of other formats:

>>> from lingpy.convert.strings import write_nexus
>>> mb = write_nexus(wl, 'mrbayes', filename='ksl-mrbayes.nex')
>>> beast = write_nexus(wl, 'beastwords', filename='ksl-beast.nex')

For more information, compare our concise LingPy tutorial (List et al. forthcoming), or the official LingPy reference.