<commit_before>package me.itszooti.geojson.gson;

import java.lang.reflect.Type;
import java.util.Arrays;
import java.util.List;

import me.itszooti.geojson.GeoFeature;
import me.itszooti.geojson.GeoFeatureCollection;
import me.itszooti.geojson.GeoGeometry;
import me.itszooti.geojson.GeoGeometryCollection;
import me.itszooti.geojson.GeoObject;

import com.google.gson.JsonDeserializationContext;
import com.google.gson.JsonDeserializer;
import com.google.gson.JsonElement;
import com.google.gson.JsonObject;
import com.google.gson.JsonParseException;

public class GeoObjectDeserializer implements JsonDeserializer<GeoObject> {

	private static final List<String> GEOMETRY_TYPES = Arrays.asList(new String[] {
		"Point", "LineString", "Polygon", "MultiPoint", "MultiLineString", "MultiPolygon"
	});
	
	@Override
	public GeoObject deserialize(JsonElement arg0, Type arg1, JsonDeserializationContext arg2) throws JsonParseException {
		// geojson is an object
		JsonObject object = arg0.getAsJsonObject();
		
		// get type
		String type = object.getAsJsonPrimitive("type").getAsString();
		
		// parse
		GeoObject geo = null;
		if (GEOMETRY_TYPES.contains(type)) {
			geo = (GeoGeometry)arg2.deserialize(object, GeoGeometry.class);
		} else if (type.equals("GeometryCollection")) {
			geo = (GeoGeometryCollection)arg2.deserialize(object, GeoGeometryCollection.class);
		} else if (type.equals("Feature")) {
			geo = (GeoFeature)arg2.deserialize(object, GeoFeature.class);
		} else if (type.equals("FeatureCollection")) {
			geo = (GeoFeatureCollection)arg2.deserialize(object, GeoFeatureCollection.class);
		}
		
		return geo;
	}

}<commit_msg>Add reminder about common parsing<commit_after>package me.itszooti.geojson.gson;

import java.lang.reflect.Type;
import java.util.Arrays;
import java.util.List;

import me.itszooti.geojson.GeoFeature;
import me.itszooti.geojson.GeoFeatureCollection;
import me.itszooti.geojson.GeoGeometry;
import me.itszooti.geojson.GeoGeometryCollection;
import me.itszooti.geojson.GeoObject;

import com.google.gson.JsonDeserializationContext;
import com.google.gson.JsonDeserializer;
import com.google.gson.JsonElement;
import com.google.gson.JsonObject;
import com.google.gson.JsonParseException;

public class GeoObjectDeserializer implements JsonDeserializer<GeoObject> {

	private static final List<String> GEOMETRY_TYPES = Arrays.asList(new String[] {
		"Point", "LineString", "Polygon", "MultiPoint", "MultiLineString", "MultiPolygon"
	});
	
	@Override
	public GeoObject deserialize(JsonElement arg0, Type arg1, JsonDeserializationContext arg2) throws JsonParseException {
		// geojson is an object
		JsonObject object = arg0.getAsJsonObject();
		
		// get type
		String type = object.getAsJsonPrimitive("type").getAsString();
		
		// parse
		GeoObject geo = null;
		if (GEOMETRY_TYPES.contains(type)) {
			geo = (GeoGeometry)arg2.deserialize(object, GeoGeometry.class);
		} else if (type.equals("GeometryCollection")) {
			geo = (GeoGeometryCollection)arg2.deserialize(object, GeoGeometryCollection.class);
		} else if (type.equals("Feature")) {
			geo = (GeoFeature)arg2.deserialize(object, GeoFeature.class);
		} else if (type.equals("FeatureCollection")) {
			geo = (GeoFeatureCollection)arg2.deserialize(object, GeoFeatureCollection.class);
		}
		
		// common objects
		// assumes that all parsing is done through this class
		// this is fine for now
		
		return geo;
	}

}
{'fraction_non_alphanumeric': 0.1129976580796253, 'fraction_numerical': 0.00468384074941452, 'mean_word_length': 5.483870967741935, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, '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}}
{'dir': 'git-commits-cleaned', 'id': '6960833', 'n_tokens_mistral': 1178, 'n_tokens_neox': 1100, 'n_words': 216}