This gist describes, how you can extract sublists from a wordlist in LingPy with help of the pyconcepticon API. See https://calc.hypotheses.org/date/2018/07 for details on the code and additional explanations.
Last active
July 16, 2018 15:08
-
-
Save LinguList/7804cb127e74a9263b4eab9c5af4bc6f to your computer and use it in GitHub Desktop.
Exporting Sublists form a Wordlist with LingPy and Concepticon
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from lingpy import * | |
from pyconcepticon.api import Concepticon | |
concepts = { | |
c.concepticon_id: c.english for c in Concepticon( | |
).conceptlists['Kolipakam-2018-100'].concepts.values() | |
} | |
jachontov = [ | |
c.concepticon_id for c in Concepticon( | |
).conceptlists['Yakhontov-1991-35'].concepts.values() | |
] | |
# get the sublist for jachontov shared with the given dataset | |
sublist = [b for a, b in concepts.items() if a in jachontov] | |
# load the wordlist | |
wl = Wordlist('DravLex.tsv') | |
# output data | |
wl.output( | |
'tsv', | |
filename='DravLex-sublist', | |
subset=True, | |
rows=dict(concept = ' in '+str(sublist)) | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment