ontolex / morph

The Morphology Module for the OntoLex Model
5 stars 6 forks source link

replacement: question on notation #13

Open pennyl67 opened 2 years ago

pennyl67 commented 2 years ago

Based on examples (e.g., https://docs.google.com/document/d/1iCv865GtEksO_wd0WC7bfU-at1dEKOOea9HSlFcTTkA/edit), morph:replacement (e.g. [morph:source "$", morph:target "ssa"]) looks more like a concatenation of source and target string, rather than a replacement. This seems to be a matter of notation. We suggest that the pattern in the source string is repeated at the target string, e.g. morph:replacement [morph:source "$", morph:target "$ssa"]. This will allow for supporting (1) the addition of a string before and after the source pattern at the same time and (2) replacement of the source string with a totally new string. This requires no changes in the diagram and is consistent with the term "replacement". Examples are provided at https://docs.google.com/document/d/1ckwhltPxJKxFpEOwTanOHHHIM0HvYm_Q38B191e1dpY/edit#heading=h.37vo5slljte6

chiarcos commented 2 years ago

conventions for replacement correspond to those of pattern matching/replacement in SPARQL, as formally defined in SPARQL 1.1 (https://www.w3.org/TR/sparql11-query/), which points to

Note that in the formal syntax definition, “\” is used to mark special characters. However, as most SPARQL engines are Java-based and Java uses “\” as an internal escape symbol, you actually have to write “\” instead of “\” as defined in the syntax. A literal single “\”-character in a regex must thus be double escaped (i.e., “\\”).

Note: This syntax originates from regular expressions in Perl (https://perldoc.perl.org/perlre). Except for minor differences in escaping and special characters, this is equivalent to the syntax of regular expressions in Java (https://www.w3schools.com/java/java_regex.asp) the syntax of regular expressions in Sed (https://www.gnu.org/software/sed/manual/html_node/Regular-Expressions.html) (and other Unix command-line tools, e.g., grep)

TODO: add pointer to draft.md

chiarcos commented 4 months ago

STATUS: