This documentation is for version 2.0.dev, which is not released yet.
Function returns lists of rows and columns specified by their name.
Parameters : | row: string (default = ‘’) :
col : string (default = ‘’)
entry: string (default = ‘’) :
flat : bool (default = False)
|
---|---|
Returns : | data : list
|
See also
Notes
The ‘col’ and ‘row’ keywords in the function are all aliased according to the description in the wordlist.rc file. Thus, instead of using these attributes, the aliases can also be taken. For selecting a language, one may type something like:
>>> Wordlist.get_list(language='LANGUAGE')
and for the selection of a concept, one may type something like:
>>> Wordlist.get_list(concept='CONCEPT')
See the examples below for details.
Examples
Load the harry_potter.csv file:
>>> wl = Wordlist('harry_potter.csv')
Select all IPA-entries for the language “German”:
>>> wl.get_list(language='German',entry='ipa'
['bain', 'hant', 'haralt']
Note that this function returns 0 for missing values (concepts that don’t have a word in the given language). If one wants to avoid this, the ‘flat’ keyword should be set to c{True}.
Select all words (orthographical representation) for the concept “Harry”:
>>> wl.get_list(concept="Harry",entry="words")
[['hæri', 'haralt', 'gari', 'gari']]
Note that the values of the list that is returned are always two-dimensional lists, since it is possible that the original file contains synonyms (multiple words corresponding to the same concept). If one wants to have a flat representation of the entries, the ‘flat’ keyword should be set to c{True}:
>>> wl.get_list(concept="Harry",entry="words",flat=True)
['hæri', 'haralt', 'gari', 'gari']