question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Mapping Languages

See original GitHub issue

Noting that you have latitude and longitude metadata for languages, you can easily plot the languages on a map to show off the world distribution of languages supported.

This adds a dependency, but would help make for an easier way in to discovering languages by region?

In a Jupyter notebook:

import folium

m = folium.Map()

for lang in list(LANGUAGES):
    folium.Marker(location=[LANGUAGES[lang].latitude, LANGUAGES[lang].longitude],
                            popup=f'{LANGUAGES[lang].name} ({lang})').add_to(m)

m

This approach might also be useful just as a quick check to make sure that markers look about right on the map…

image

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:6 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
kylepjohnsoncommented, Jun 26, 2021

I pulled this code out for a presentation and it worked really well. Recording here for posterity.

from cltk.languages.glottolog import LANGUAGES
import folium

# example tiles:
# https://leaflet-extras.github.io/leaflet-providers/preview/

attribution = 'Map tiles by <a href="http://stamen.com">Stamen Design</a>, <a href="http://creativecommons.org/licenses/by/3.0">CC BY 3.0</a> &mdash; Map data &copy; <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors'

_map = folium.Map(location=[32.535164526, 44.41916499], zoom_start=2, 
                  tiles="https://stamen-tiles-{s}.a.ssl.fastly.net/terrain-background/{z}/{x}/{y}{r}.png",
                  attr=attribution,
                 )

for name, lang_obj in LANGUAGES.items():
    folium.Circle(
        radius=400,
        location=[lang_obj.latitude, lang_obj.longitude],
        popup=f"<i>{lang_obj.name}</i>",
        tooltip=f"{lang_obj.name} (\"{lang_obj.iso_639_3_code}\")",
        color="crimson",
        fill=False,
    ).add_to(_map)

_map.save("glottolog-map.html")
_map
folium-map-grab
1reaction
psychemediacommented, May 26, 2021

@kylepjohnson I guess my use case is more related to how cltk can be used to support authoring of simple learning materials, both from authoring and student activity perspective. To that end, the use cases will verge on the “not interesting” to folk developing cltk for research purposes, although they may help provide an on ramp. If there are other simple-but-useful things I’m missing, if you let me know I can try to write examples around them.

(You’re welcome to take the material for use as docs - they should be appropriately licensed. If not, I hereby grant cltk org a CC0 license with the rider that you at least CC-BY (or similar) them with at least a cltk attribution. I’m sorry I can’t commit to adding to your docs directly at the moment; I’m trying to cover a lot of other bases too so I’m working at a “good enough for a demo” rather than “strictly correct” documentation level…)

Read more comments on GitHub >

github_iconTop Results From Across the Web

23 maps and charts on language - Vox
This map shows the language in which the plurality of Wikipedia articles on a given country are written. Some countries match up.
Read more >
What Are Language Maps? - TLTC Blogs |
Mapping languages can be done in geographical space. We can map a language's “homeland.” For instance, English spoken in the United States arguably...
Read more >
5. Mapping language data - De Gruyter
MLA · APA · Harvard · Chicago · Vancouver.
Read more >
Mapping Languages: The Corpus of Global Language Use
This paper describes a web-based corpus of global language use with a focus on how this corpus can be used for data-driven language...
Read more >
Language Mapping
Mapping Linguistic Diversity in a Globalizing World through Open Source Digital Tools. Languages of New York City is a free and interactive digital...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found