<jupyter_start><jupyter_text>To csv<jupyter_code>def formatOSMInfoCSV( merimee, info ):
    osmtype = info['typeOSM']
    desc = info['name'] if 'name' in info else '...'
    idOSM = info['idOSM']
    
    osmUrl = 'https://www.openstreetmap.org/%s/%s' % (osmtype, idOSM)
   
    if 'wikidata' in info:
        wikidataUrl = 'https://www.wikidata.org/wiki/%s' % info['wikidata']
    else:
        wikidataUrl = ''
        
    return ','.join( (merimee, osmtype, str(idOSM), osmUrl, wikidataUrl, desc) )
csv = 'merimee, osmtype, idOSM, osmUrl, wikidataUrl, desc\n'
for merimee, indices in listOfDuplicates:
    csv += '\n'.join( [formatOSMInfoCSV(merimee, dataOSM[i]) for i in indices] )
    csv += '\n'
    
with open('duplicateOSM.csv', 'w') as file:
    file.write( csv )<jupyter_output><empty_output><jupyter_text>To Github issues<jupyter_code>import requests
import json
token = open('githubtoken.txt','r').read().strip()
def formatOSMInfoIssue( merimee, indices ):

    page = ''
    page +=  '**%s**:   \n ' % merimee
    page += '\n'.join( [formatOSMInfo(dataOSM[i]) for i in indices] )

    newissue = {
      "title": '%s: %s (%i)' % (merimee, 'desc', len(indices)),
      "body": page,
      "labels": [
        'doublons_osm'
      ]
    }
        
    return json.dumps( newissue )
for merimee, indices in listOfDuplicates[:2]:
    newIssue = formatOSMInfoIssue( merimee, indices )

    # create an issue
    r = requests.post('https://api.github.com/repos/xdze2/OSM_et_Wikidata/issues', 
                     headers={'Authorization': 'token %s'%token},
                    data=newIssue)
    print( r.ok )
r.url
# create an issue
r = requests.post('https://api.github.com/repos/xdze2/OSM_et_Wikidata/issues', 
                 headers={'Authorization': 'token %s'%token},
                data=json.dumps( newissue ))
r.text<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.16167023554603854, 'fraction_numerical': 0.0016059957173447537, 'mean_word_length': 2.976595744680851, 'pattern_counts': {'":': 3, '<': 9, '<?xml version=': 0, '>': 9, 'https://': 4, 'lorem ipsum': 0, 'www.': 2, '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': '2', 'dir': 'jupyter-structured-clean-dedup', 'id': '538242', 'license': 'MIT', 'n_tokens_mistral': 715, 'n_tokens_neox': 692, 'n_words': 137, 'path': 'duplicateOSM.ipynb', 'repo_name': 'xdze2/OSM_et_Wikidata', 'size': '1868'}