APIs for different linguistic databases can be accessed with lingtypology.db_apis
.
import lingtypology.db_apis
It is possible to access Wals data (online) using lingtypology.db_apis.Wals
from lingtypology.db_apis import Wals
You can get the list of Wals pages by running:
Wals().features_list
You can get multiple Wals pages by passing their names into Wals
.
Method get_df
returns the data in pandas.DataFrame
type. You can also get it as dict
using get_json
method.
wals_page = Wals('1a', '2a').get_df()
wals_page.head()
Finally, we can now easily draw a map out of the data from the Wals page "1A" (size of consonant inventory).
m = lingtypology.LingMap(wals_page.language)
m.add_custom_coordinates(wals_page.coordinates)
m.add_features(wals_page._1A)
m.legend_title = 'Consonant Inventory'
m._create_map()
It is possible to access Autotyp data (online) using lingtypology.db_apis
.
from lingtypology.db_apis import Autotyp
To get the list of Autotyp features run:
Autotyp().features_list
Unlike in Wals, each new tablename passed into Autotyp
gives several additional columns:
Autotyp_table = Autotyp('Gender', 'Agreement').get_df()
Autotyp_table.head()
Now we can draw a map out of gender data from multiple languages.
m = lingtypology.LingMap(Autotyp_table.Language)
m.add_features(Autotyp_table['Gender.binned4'])
m.legend_title = 'Genders'
m._create_map()
from lingtypology.db_apis import AfBo
To get the list of features from AfBo run:
AfBo().features_list
To get the AfBo data as dict
, you can use get_json
method. To get data as pandas.DataFrame
you can run:
c = AfBo('comparative').get_df()
c.head()
m = lingtypology.LingMap(c.Recipient_name)
m.add_features(c['comparative'])
m._create_map()
#adj['possessor indexing']
from lingtypology.db_apis import Sails
Get list of features:
Sails().features_list
To get a pandas.DataFrame
of features and descriptions:
Sails().features_descriptions.head()
Get description for particular features:
Sails().feature_descriptions('ICU10', 'ICU11')
To get the SAILS data as dict
, you can use get_json
method. To get data as pandas.DataFrame
you can run:
sails = Sails('ICU10', 'ICU11')
df = sails.get_df()
df.head()
Map example:
m = lingtypology.LingMap(df.Language)
m.add_features(df.ICU11_desc)
m.legend_title = sails.feature_descriptions('ICU11').Description.at[0]
m.start_location = (9, -79)
m.start_zoom = 5
m._create_map()