From 6efead46d0e139cc6ca0c6b4d801da390319b1a8 Mon Sep 17 00:00:00 2001 From: Matthias Mohr Date: Fri, 17 May 2024 15:54:38 +0200 Subject: [PATCH 1/2] Add text_position --- CHANGELOG.md | 4 ++ proposals/text_position.json | 93 ++++++++++++++++++++++++++++++++++++ 2 files changed, 97 insertions(+) create mode 100644 proposals/text_position.json diff --git a/CHANGELOG.md b/CHANGELOG.md index d870ae83..dbffb2e6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## Unreleased / Draft +### Added + +- `text_position` + ### Changed - `clip`: Throw an exception if min > max [#472](https://github.com/Open-EO/openeo-processes/issues/472) diff --git a/proposals/text_position.json b/proposals/text_position.json new file mode 100644 index 00000000..b96e917c --- /dev/null +++ b/proposals/text_position.json @@ -0,0 +1,93 @@ +{ + "id": "text_position", + "summary": "First position of a text in another text", + "description": "Checks where the text (also known as *string*) specified for `pattern` is positioned in the text specified for `data` for the first time. No-data values are passed through.", + "categories": [ + "texts" + ], + "experimental": true, + "parameters": [ + { + "name": "data", + "description": "Text in which to find something in.", + "schema": { + "type": [ + "string", + "null" + ] + } + }, + { + "name": "pattern", + "description": "Text to find in `data`. Regular expressions are not supported.", + "schema": { + "type": "string" + } + }, + { + "name": "case_sensitive", + "description": "Case sensitive comparison can be disabled by setting this parameter to `false`.", + "schema": { + "type": "boolean" + }, + "default": true, + "optional": true + } + ], + "returns": { + "description": "A value >= 0 that indicates the position of the text, `-1` if the text was not found.", + "schema": { + "type": [ + "integer", + "null" + ], + "minimum": -1 + } + }, + "examples": [ + { + "arguments": { + "data": "Lorem ipsum dolor sit amet", + "pattern": "openEO" + }, + "returns": -1 + }, + { + "arguments": { + "data": "Lorem ipsum dolor sit amet", + "pattern": "ipsum dolor" + }, + "returns": 6 + }, + { + "arguments": { + "data": "Lorem ipsum dolor sit amet", + "pattern": "Ipsum Dolor" + }, + "returns": -1 + }, + { + "arguments": { + "data": "Lorem ipsum dolor sit amet", + "pattern": "SIT", + "case_sensitive": false + }, + "returns": 18 + }, + { + "arguments": { + "data": "ÄÖÜ", + "pattern": "ö", + "case_sensitive": false + }, + "returns": 1 + }, + { + "arguments": { + "data": null, + "pattern": "null" + }, + "returns": null + } + ] +} From 280243f64f3006e82f112d73e5aa4295f3e35f74 Mon Sep 17 00:00:00 2001 From: Matthias Mohr Date: Wed, 29 May 2024 20:58:48 +0200 Subject: [PATCH 2/2] Updates according to review --- proposals/{text_position.json => text_find.json} | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) rename proposals/{text_position.json => text_find.json} (93%) diff --git a/proposals/text_position.json b/proposals/text_find.json similarity index 93% rename from proposals/text_position.json rename to proposals/text_find.json index b96e917c..e90d344e 100644 --- a/proposals/text_position.json +++ b/proposals/text_find.json @@ -1,5 +1,5 @@ { - "id": "text_position", + "id": "text_find", "summary": "First position of a text in another text", "description": "Checks where the text (also known as *string*) specified for `pattern` is positioned in the text specified for `data` for the first time. No-data values are passed through.", "categories": [ @@ -35,13 +35,13 @@ } ], "returns": { - "description": "A value >= 0 that indicates the position of the text, `-1` if the text was not found.", + "description": "A value >= 0 that indicates the position of the text, `null` if the text was not found.", "schema": { "type": [ "integer", "null" ], - "minimum": -1 + "minimum": 0 } }, "examples": [ @@ -50,7 +50,7 @@ "data": "Lorem ipsum dolor sit amet", "pattern": "openEO" }, - "returns": -1 + "returns": null }, { "arguments": { @@ -64,7 +64,7 @@ "data": "Lorem ipsum dolor sit amet", "pattern": "Ipsum Dolor" }, - "returns": -1 + "returns": null }, { "arguments": {