<jupyter_start><jupyter_text>Leaflet cluster map of talk locationsset folder as the _talks directory, which contains .md files of all your talks, and Run this notebook. This scrapes the location YAML field from each .md file, geolocates it with geopy/Nominatim, and uses the getorg library to output data, HTML, and Javascript for a standalone cluster map.<jupyter_code>!pip install getorg --upgrade
#import glob
import os
import getorg
from geopy import Nominatim
#g = glob.glob("*.md")
folder='./_talks/'
g = [f for f in os.listdir(folder) if os.path.isfile(os.path.join(folder, f)) and f.endswith('.md')]
g
geocoder = Nominatim()
location_dict = {}
location = ""
permalink = ""
title = ""

for file in g:
    with open(folder+file, 'r',encoding='utf-8') as f:
        lines = f.read()
        if lines.find('location: "') > 1:
            loc_start = lines.find('location: "') + 11
            lines_trim = lines[loc_start:]
            loc_end = lines_trim.find('"')
            location = lines_trim[:loc_end]
                            
           
        location_dict[location] = geocoder.geocode(location)
        print(location, "\n", location_dict[location])

m = getorg.orgmap.create_map_obj()
getorg.orgmap.output_html_cluster_map(location_dict, folder_name="./talkmap", hashed_usernames=False)<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.1179985063480209, 'fraction_numerical': 0.002987303958177745, 'mean_word_length': 3.451827242524917, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 6, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '1', 'dir': 'jupyter-structured-clean-dedup', 'id': '498030', 'license': 'MIT', 'n_tokens_mistral': 441, 'n_tokens_neox': 428, 'n_words': 120, 'path': 'talkmap.ipynb', 'repo_name': 'hxbaishikele/resume', 'size': '1339'}