<commit_before>:- module(
  wkt,
  [
    wkt//2,    % +Name, +Array
    wkt_name/1 % ?Name
  ]
).

/** <module> Well-Known Text (WKT)

A **linear ring** is a closed line string of at least four positions,
where the first and the last position are the same (both syntactically
and semantically).

A **polygon** consists of exactly one Exterior linear ring and zero or
more interior linear rings (Interiors).

@author <NAME>
@version 2016/05-2016/06
*/

:- use_module(library(dcg/dcg_ext)).





circularstring_text(_, L) -->
  empty_set(L), !.
circularstring_text(ZM, L) -->
  "( ", seplist(point(ZM), +(blank), L), " )".


circularstring_text_representation(ZM1, circularstring(L)) -->
  "CIRCULARSTRING ",
  z_m(ZM1, ZM2),
  circularstring_text(ZM2, L).



collection_text_representation(ZM, L) -->
  multipoint_text_representation(ZM, L), !.
collection_text_representation(ZM, L) -->
  multicurve_text_representation(ZM, L), !.
collection_text_representation(ZM, L) -->
  multisurface_text_representation(ZM, L), !.
collection_text_representation(ZM, L) -->
  geometrycollection_text_representation(ZM, L).



compoundcurve_text(_, L) -->
  empty_set(L), !.
compoundcurve_text(ZM, L) -->
  "( ", seplist('single curve text'(ZM), +(blank), L), " )".



compoundcurve_text_representation(ZM1, compoundcurve(L)) -->
  "COMPOUNDCURVE ",
  z_m(ZM1, ZM2),
  compoundcurve_text(ZM2, L).



curve_text(ZM, L) -->
  linestring_text_body(ZM, L), !.
curve_text(ZM, L) -->
  circularstring_text_representation(ZM, L), !.
curve_text(ZM, L) -->
  compoundcurve_text_representation(ZM, L).


curve_text_representation(ZM, L) -->
  linestring_text_representation(ZM, L), !.
curve_text_representation(ZM, L) -->
  circularstring_text_representation(ZM, L), !.
curve_text_representation(ZM, L) -->
  compoundcurve_text_representation(ZM, L).



curvepolygon_text(_, L) -->
  empty_set(L), !.
curvepolygon_text(ZM, L) -->
  "( ", seplist(ring_text(ZM), +(blank), L), " )".


curvepolygon_text_body(ZM, L) -->
  curvepolygon_text(ZM, L).


curvepolygon_text_representation(ZM1, curvepolygon(L)) -->
  "CURVEPOLYGON ",
  z_m(ZM1, ZM2),
  curvepolygon_text_body(ZM2, L), !.
curvepolygon_text_representation(ZM, L) -->
  polygon_text_representation(ZM, L), !.
curvepolygon_text_representation(ZM, L) -->
  triangle_text_representation(ZM, L).



geometrycollection_text(_, L) -->
  empty_set(L), !.
geometrycollection_text(ZM, L) -->
  seplist(wkt_representation(ZM), +(blank), L), " )".


geometrycollection_text_representation(ZM1, geometrycollection(L)) -->
  "GEOMETRYCOLLECTION ",
  z_m(ZM1, ZM2),
  geometrycollection_text(ZM2, L).



linestring_text(_, L) -->
  empty_set(L), !.
linestring_text(ZM, L) -->
  "( ", seplist(point(ZM), +(blank), L), " )".


linestring_text_body(ZM, L) -->
  linestring_text(ZM, L).


linestring_text_representation(ZM1, linestring(L)) -->
  "LINESTRING ",
  z_m(ZM1, ZM2),
  linestring text body(ZM2, L).



multicurve_text(_, L) -->
  empty_set(L), !.
multicurve_text(ZM, L) -->
  "( ", seplist(curve_text(ZM), +(blank), L), " )".

<commit_msg>FIXED: typo.<commit_after>:- module(
  wkt,
  [
    wkt//2,    % +Name, +Array
    wkt_name/1 % ?Name
  ]
).

/** <module> Well-Known Text (WKT)

A **linear ring** is a closed line string of at least four positions,
where the first and the last position are the same (both syntactically
and semantically).

A **polygon** consists of exactly one Exterior linear ring and zero or
more interior linear rings (Interiors).

@author <NAME>
@version 2016/05-2016/06
*/

:- use_module(library(dcg/dcg_ext)).





circularstring_text(_, L) -->
  empty_set(L), !.
circularstring_text(ZM, L) -->
  "( ", seplist(point(ZM), +(blank), L), " )".


circularstring_text_representation(ZM1, circularstring(L)) -->
  "CIRCULARSTRING ",
  z_m(ZM1, ZM2),
  circularstring_text(ZM2, L).



collection_text_representation(ZM, L) -->
  multipoint_text_representation(ZM, L), !.
collection_text_representation(ZM, L) -->
  multicurve_text_representation(ZM, L), !.
collection_text_representation(ZM, L) -->
  multisurface_text_representation(ZM, L), !.
collection_text_representation(ZM, L) -->
  geometrycollection_text_representation(ZM, L).



compoundcurve_text(_, L) -->
  empty_set(L), !.
compoundcurve_text(ZM, L) -->
  "( ", seplist('single curve text'(ZM), +(blank), L), " )".



compoundcurve_text_representation(ZM1, compoundcurve(L)) -->
  "COMPOUNDCURVE ",
  z_m(ZM1, ZM2),
  compoundcurve_text(ZM2, L).



curve_text(ZM, L) -->
  linestring_text_body(ZM, L), !.
curve_text(ZM, L) -->
  circularstring_text_representation(ZM, L), !.
curve_text(ZM, L) -->
  compoundcurve_text_representation(ZM, L).


curve_text_representation(ZM, L) -->
  linestring_text_representation(ZM, L), !.
curve_text_representation(ZM, L) -->
  circularstring_text_representation(ZM, L), !.
curve_text_representation(ZM, L) -->
  compoundcurve_text_representation(ZM, L).



curvepolygon_text(_, L) -->
  empty_set(L), !.
curvepolygon_text(ZM, L) -->
  "( ", seplist(ring_text(ZM), +(blank), L), " )".


curvepolygon_text_body(ZM, L) -->
  curvepolygon_text(ZM, L).


curvepolygon_text_representation(ZM1, curvepolygon(L)) -->
  "CURVEPOLYGON ",
  z_m(ZM1, ZM2),
  curvepolygon_text_body(ZM2, L), !.
curvepolygon_text_representation(ZM, L) -->
  polygon_text_representation(ZM, L), !.
curvepolygon_text_representation(ZM, L) -->
  triangle_text_representation(ZM, L).



geometrycollection_text(_, L) -->
  empty_set(L), !.
geometrycollection_text(ZM, L) -->
  seplist(wkt_representation(ZM), +(blank), L), " )".


geometrycollection_text_representation(ZM1, geometrycollection(L)) -->
  "GEOMETRYCOLLECTION ",
  z_m(ZM1, ZM2),
  geometrycollection_text(ZM2, L).



linestring_text(_, L) -->
  empty_set(L), !.
linestring_text(ZM, L) -->
  "( ", seplist(point(ZM), +(blank), L), " )".


linestring_text_body(ZM, L) -->
  linestring_text(ZM, L).


linestring_text_representation(ZM1, linestring(L)) -->
  "LINESTRING ",
  z_m(ZM1, ZM2),
  linestring_text_body(ZM2, L).



multicurve_text(_, L) -->
  empty_set(L), !.
multicurve_text(ZM, L) -->
  "( ", seplist(curve_text(ZM), +(blank), L), " )".


{'fraction_non_alphanumeric': 0.17083129185040014, 'fraction_numerical': 0.01110566715662257, 'mean_word_length': 4.644239631336405, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 69, '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': '1256713', 'n_tokens_mistral': 2593, 'n_tokens_neox': 2417, 'n_words': 407}