Skip to content

Instantly share code, notes, and snippets.

@martin12333
Last active November 18, 2018 10:26
Show Gist options
  • Save martin12333/a3ec0b90d6bb3a58854531c61f4a3f97 to your computer and use it in GitHub Desktop.
Save martin12333/a3ec0b90d6bb3a58854531c61f4a3f97 to your computer and use it in GitHub Desktop.
(a recorded "macro") ... BCI_AV-meanings_n.xls.openrefine
1.Text transform on 0 cells in column Derivation - explanation: grel:value.replace(/\t/,' --- ')
2.Text transform on 0 cells in column Derivation - explanation: grel:value.replace(/\n/,' --- ')
3.Create new column loc_img based on column English by filling 5835 rows with grel:'http://127.0.0.1:3333/images/blissymbolics.org/bliss_h_transp_png/'+cells.English.value.escape('url')+'.png'
4.Move column loc_img to position 3
5.Rename column loc_img to local_img
6.Create new column engl1 based on column English by filling 5835 rows with grel:value.replace(/[(][^)]*[)]/,'()')
7.Text transform on 90 cells in column engl1: grel:value.replace(/[-_()]*[,]/,',')
8.Text transform on 1764 cells in column engl1: grel:value.replace(/[-_()]*$/,'')
9.Split multi-valued cells in column engl1
10.Fill down 2774 cells in column BCI-AV#
11.Fill down 2774 cells in column English
12.Fill down 2774 cells in column POS
13.Fill down 2774 cells in column local_img
14.Fill down 2774 cells in column Derivation - explanation
15.Fill down 2774 cells in column BCI-AV#2
16.Fill down 3021 cells in column Swedish
17.Fill down 3023 cells in column German
18.Fill down 3021 cells in column Russian
19.Fill down 3938 cells in column French
20.Create new column meanings_n based on column engl1 by filling 8609 rows with grel:cell.cross("engl1", "engl1").length()
[
{
"op": "core/text-transform",
"description": "Text transform on cells in column Derivation - explanation using expression grel:value.replace(/\\t/,' --- ')",
"engineConfig": {
"facets": [],
"mode": "row-based"
},
"columnName": "Derivation - explanation",
"expression": "grel:value.replace(/\\t/,' --- ')",
"onError": "keep-original",
"repeat": false,
"repeatCount": 10
},
{
"op": "core/text-transform",
"description": "Text transform on cells in column Derivation - explanation using expression grel:value.replace(/\\n/,' --- ')",
"engineConfig": {
"facets": [],
"mode": "row-based"
},
"columnName": "Derivation - explanation",
"expression": "grel:value.replace(/\\n/,' --- ')",
"onError": "keep-original",
"repeat": false,
"repeatCount": 10
},
{
"op": "core/column-addition",
"description": "Create column loc_img at index 2 based on column English using expression grel:'http://127.0.0.1:3333/images/blissymbolics.org/bliss_h_transp_png/'+cells.English.value.escape('url')+'.png'",
"engineConfig": {
"facets": [],
"mode": "row-based"
},
"newColumnName": "loc_img",
"columnInsertIndex": 2,
"baseColumnName": "English",
"expression": "grel:'http://127.0.0.1:3333/images/blissymbolics.org/bliss_h_transp_png/'+cells.English.value.escape('url')+'.png'",
"onError": "set-to-blank"
},
{
"op": "core/column-move",
"description": "Move column loc_img to position 3",
"columnName": "loc_img",
"index": 3
},
{
"op": "core/column-rename",
"description": "Rename column loc_img to local_img",
"oldColumnName": "loc_img",
"newColumnName": "local_img"
},
{
"op": "core/column-addition",
"description": "Create column engl1 at index 2 based on column English using expression grel:value.replace(/[(][^)]*[)]/,'()')",
"engineConfig": {
"facets": [],
"mode": "row-based"
},
"newColumnName": "engl1",
"columnInsertIndex": 2,
"baseColumnName": "English",
"expression": "grel:value.replace(/[(][^)]*[)]/,'()')",
"onError": "set-to-blank"
},
{
"op": "core/text-transform",
"description": "Text transform on cells in column engl1 using expression grel:value.replace(/[-_()]*[,]/,',')",
"engineConfig": {
"facets": [],
"mode": "row-based"
},
"columnName": "engl1",
"expression": "grel:value.replace(/[-_()]*[,]/,',')",
"onError": "keep-original",
"repeat": false,
"repeatCount": 10
},
{
"op": "core/text-transform",
"description": "Text transform on cells in column engl1 using expression grel:value.replace(/[-_()]*$/,'')",
"engineConfig": {
"facets": [],
"mode": "row-based"
},
"columnName": "engl1",
"expression": "grel:value.replace(/[-_()]*$/,'')",
"onError": "keep-original",
"repeat": false,
"repeatCount": 10
},
{
"op": "core/multivalued-cell-split",
"description": "Split multi-valued cells in column engl1",
"columnName": "engl1",
"keyColumnName": "BCI-AV#",
"mode": "separator",
"separator": ",",
"regex": false
},
{
"op": "core/fill-down",
"description": "Fill down cells in column BCI-AV#",
"engineConfig": {
"facets": [],
"mode": "row-based"
},
"columnName": "BCI-AV#"
},
{
"op": "core/fill-down",
"description": "Fill down cells in column English",
"engineConfig": {
"facets": [],
"mode": "row-based"
},
"columnName": "English"
},
{
"op": "core/fill-down",
"description": "Fill down cells in column POS",
"engineConfig": {
"facets": [],
"mode": "row-based"
},
"columnName": "POS"
},
{
"op": "core/fill-down",
"description": "Fill down cells in column local_img",
"engineConfig": {
"facets": [],
"mode": "row-based"
},
"columnName": "local_img"
},
{
"op": "core/fill-down",
"description": "Fill down cells in column Derivation - explanation",
"engineConfig": {
"facets": [],
"mode": "row-based"
},
"columnName": "Derivation - explanation"
},
{
"op": "core/fill-down",
"description": "Fill down cells in column BCI-AV#2",
"engineConfig": {
"facets": [],
"mode": "row-based"
},
"columnName": "BCI-AV#2"
},
{
"op": "core/fill-down",
"description": "Fill down cells in column Swedish",
"engineConfig": {
"facets": [],
"mode": "row-based"
},
"columnName": "Swedish"
},
{
"op": "core/fill-down",
"description": "Fill down cells in column German",
"engineConfig": {
"facets": [],
"mode": "row-based"
},
"columnName": "German"
},
{
"op": "core/fill-down",
"description": "Fill down cells in column Russian",
"engineConfig": {
"facets": [],
"mode": "row-based"
},
"columnName": "Russian"
},
{
"op": "core/fill-down",
"description": "Fill down cells in column French",
"engineConfig": {
"facets": [],
"mode": "row-based"
},
"columnName": "French"
},
{
"op": "core/column-addition",
"description": "Create column meanings_n at index 3 based on column engl1 using expression grel:cell.cross(\"engl1\", \"engl1\").length()",
"engineConfig": {
"facets": [],
"mode": "row-based"
},
"newColumnName": "meanings_n",
"columnInsertIndex": 3,
"baseColumnName": "engl1",
"expression": "grel:cell.cross(\"engl1\", \"engl1\").length()",
"onError": "set-to-blank"
}
]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment