<commit_before><?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xs="http://www.w3.org/2001/XMLSchema" exclude-result-prefixes="#all" version="2.0" xmlns:xi="http://www.w3.org/2001/XInclude">
	<xsl:template match="/">
		
		<xsl:choose>
			<xsl:when test="count(//lst[@name='georef']/int) &gt; 0">
				<xsl:text>{"type": "FeatureCollection","features": [</xsl:text>
				<xsl:apply-templates select="//lst[@name='georef']/int"/>
				<xsl:text>]}</xsl:text>
			</xsl:when>
			<xsl:otherwise>{}</xsl:otherwise>
		</xsl:choose>
	</xsl:template>
	
	

	<xsl:template match="int">
		<xsl:variable name="tokenized_georef" select="tokenize(@name, '\|')"/>
		<xsl:variable name="url" select="concat('http://www.geonames.org/', $tokenized_georef[1])"/>
		<xsl:variable name="place" select="$tokenized_georef[2]"/>
		<xsl:variable name="coordinates" select="$tokenized_georef[3]"/>
		
		<!-- long comes before lat in index -->
		<xsl:variable name="long" select="normalize-space(substring-before($coordinates, ','))"/>
		<xsl:variable name="lat" select="normalize-space(substring-after($coordinates, ','))"/>
		
		<xsl:text>{"type": "Feature","label":"</xsl:text>
		<xsl:value-of select="$place"/>
		<xsl:text>",</xsl:text>		
		<!-- geometry -->
		<xsl:text>"geometry": {"type": "Point","coordinates": [</xsl:text>
		<xsl:value-of select="$long"/>
		<xsl:text>, </xsl:text>
		<xsl:value-of select="$lat"/>
		<xsl:text>]},</xsl:text>
		
		<!-- properties -->
		<xsl:text>"properties": {"toponym": "</xsl:text>
		<xsl:value-of select="$place"/>
		<xsl:text>","gazetteer_label": "</xsl:text>
		<xsl:value-of select="$place"/>
		<xsl:text>", "gazetteer_uri": "</xsl:text>
		<xsl:value-of select="$url"/>
		<xsl:text>","type": "relatedPlace","georef":"</xsl:text>
		<xsl:value-of select="@name"/>
		<xsl:text>"</xsl:text>
		<xsl:text>}}</xsl:text>
		<xsl:if test="not(position()=last())">
			<xsl:text>,</xsl:text>
		</xsl:if>
	</xsl:template>
<commit_msg>updated geojson to exclude points without coordinates<commit_after><?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xs="http://www.w3.org/2001/XMLSchema" exclude-result-prefixes="#all" version="2.0" xmlns:xi="http://www.w3.org/2001/XInclude">
	<xsl:template match="/">
		
		<xsl:choose>
			<xsl:when test="count(//lst[@name='georef']/int) &gt; 0">
				<xsl:text>{"type": "FeatureCollection","features": [</xsl:text>
				<xsl:apply-templates select="//lst[@name='georef']/int"/>
				<xsl:text>]}</xsl:text>
			</xsl:when>
			<xsl:otherwise>{}</xsl:otherwise>
		</xsl:choose>
	</xsl:template>
	
	

	<xsl:template match="int">
		<xsl:variable name="tokenized_georef" select="tokenize(@name, '\|')"/>
		<xsl:variable name="url" select="concat('http://www.geonames.org/', $tokenized_georef[1])"/>
		<xsl:variable name="place" select="$tokenized_georef[2]"/>
		<xsl:variable name="coordinates" select="$tokenized_georef[3]"/>
		
		<!-- long comes before lat in index -->
		<xsl:variable name="long" select="normalize-space(substring-before($coordinates, ','))"/>
		<xsl:variable name="lat" select="normalize-space(substring-after($coordinates, ','))"/>
		
		<!-- only include features that have valid lat and long -->
		<xsl:if test="$lat castable as xs:integer and $long castable as xs:integer">
			<xsl:text>{"type": "Feature","label":"</xsl:text>
			<xsl:value-of select="$place"/>
			<xsl:text>",</xsl:text>		
			<!-- geometry -->
			<xsl:text>"geometry": {"type": "Point","coordinates": [</xsl:text>
			<xsl:value-of select="$long"/>
			<xsl:text>, </xsl:text>
			<xsl:value-of select="$lat"/>
			<xsl:text>]},</xsl:text>
			
			<!-- properties -->
			<xsl:text>"properties": {"toponym": "</xsl:text>
			<xsl:value-of select="$place"/>
			<xsl:text>","gazetteer_label": "</xsl:text>
			<xsl:value-of select="$place"/>
			<xsl:text>", "gazetteer_uri": "</xsl:text>
			<xsl:value-of select="$url"/>
			<xsl:text>","type": "relatedPlace","georef":"</xsl:text>
			<xsl:value-of select="@name"/>
			<xsl:text>"</xsl:text>
			<xsl:text>}}</xsl:text>
			<xsl:if test="not(position()=last())">
				<xsl:text>,</xsl:text>
			</xsl:if>
		</xsl:if>
	</xsl:template>

{'fraction_non_alphanumeric': 0.25563731307856635, 'fraction_numerical': 0.011393306432470923, 'mean_word_length': 5.178885630498534, 'pattern_counts': {'":': 26, '<': 124, '<?xml version=': 2, '>': 124, 'https://': 0, 'lorem ipsum': 0, 'www.': 8, 'xml': 8}, '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}}
{'dir': 'git-commits-cleaned', 'id': '3386119', 'n_tokens_mistral': 1845, 'n_tokens_neox': 1533, 'n_words': 218}