Skip to content

Commit

Permalink
FIX: use spContext from common.js (#10)
Browse files Browse the repository at this point in the history
closes #10
  • Loading branch information
dwhieb committed Feb 8, 2021
1 parent 374e6cf commit e89bdfa
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 35 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ Korp is developed by [Språkbanken](https://spraakbanken.gu.se) at the Universit
- build a dist version: set `NODE_ENV=production`, then `yarn build`

1. Running Korp
- run dev server: `yarn dev`
- run dist server: `yarn start`
- run dev server: `yarn start:dev` or `yarn dev`
- run dist server: `yarn start:dist` or `yarn start`

1. Running tests
- run tests: `yarn test` or `yarn test:karma` or `yarn test:e2e`
Expand Down
5 changes: 4 additions & 1 deletion app/modes/common.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,12 @@ var liteOptions = {
is: `=`,
is_not: `!=`,
};

var setOptions = {
is: `contains`,
is_not: `not contains`,
};

var probabilitySetOptions = {
is: `highest_rank`,
is_not: `not_highest_rank`,
Expand All @@ -35,12 +37,13 @@ var spContext = {
"1 sentence": `1 sentence`,
"1 paragraph": `1 paragraph`,
};

var spWithin = {
sentence: `sentence`,
paragraph: `paragraph`,
};

var attrs = {}; // positional attributes
var attrs = {}; // positional attributes
var sattrs = {}; // structural attributes

attrs.pos = {
Expand Down
52 changes: 21 additions & 31 deletions app/modes/default_mode.js
Original file line number Diff line number Diff line change
@@ -1,57 +1,47 @@
settings.corpora = {};
settings.corporafolders = {};

// settings.corporafolders.sweac = {
// title: "Akademiska texter",
// contents: ["sweachum", "sweacsam"],
// description: "A description"
// };

settings.corporafolders.crk = {
title: `nêhiyawêwin (Plains Cree) texts`,
// corpora included in this folder
contents: [`wolfart_ahenakew`],
// description for this folder
// description: `A description,`
// appears in the corpus selection dropdown for this folder
title: `nêhiyawêwin (Plains Cree) texts`,
};

/*
* PRESELECTED CORPORA
* Folders will be expanded to all corpora. Optionally prefix folders with __ , which will be ignored.
* Folders will be expanded to all corpora.
* Optionally prefix folders with __ , which will be ignored.
*/
settings.preselectedCorpora = [`wolfart_ahenakew`];

// settings.corpora["magmakolumner"] = {
// id: "magmakolumner",
// title: "Magma kolumner 2009–2012",
// description: "Material ur kolumner publicerade av <a target=\"_blank\" href=\"http://www.magma.fi\">Tankesmedjan Magma</a>",
// within: spWithin,
// context: spContext,
// attributes: modernAttrs,
// structAttributes: {
// text_author: {label: "author"},
// text_title: {label: "title"},
// text_date: {label: "date"}
// }
// };

settings.corpora.wolfart_ahenakew = {

id: `wolfart_ahenakew`,
title: `Ahenakew-Wolfart Texts`,
title: `Ahenakew-Wolfart Texts`, // displayed in info box under "Corpus"
description: `Plains Cree texts compiled and edited by H. C. Wolfart and Freda Ahenakew`,
// limited_access : true, // This will be invoked once we get basic search functionality working
within: settings.defaultWithin, // According to Korp Frontend specs
context: settings.spContext, // According to Korp Frontend specs
within: spWithin, // from common.js; sp = sentence/paragraph
context: spContext, // from common.js; sp = sentence/paragraph

// attributes are displayed in the info box under "Word attributes"
attributes: {
msd: attrs.msd,
dep: attrs.dep,
gloss: attrs.gloss, // This may need to be specified some/elsewhere, as it is ALTLab-specific
lemma: attrs.baseform,
dep: attrs.dep,
msd: attrs.msd,
},

// structural attributes are displayed in the info box under "Text attributes"
structAttributes: {
text_author: { label: `author` },
text_title: { label: `title` },
text_title1: { label: `text_title1` },
text_title2: { label: `text_title2` },
text_lang: { label: `lang` },
text_title: { label: `title` },
text_title1: { label: `text_title1` }, // not sure why we have multiple titles [DWH]
text_title2: { label: `text_title2` }, // not sure why we have multiple titles [DWH]
},

};

settings.corpusListing = new CorpusListing(settings.corpora);
4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -85,11 +85,13 @@
},
"scripts": {
"build": "webpack",
"dev": "webpack-dev-server -d --config webpack.dev.js",
"start:dev": "webpack-dev-server -d --config webpack.dev.js",
"lint": "tslint --project tslint.json",
"posttest": "kill $(lsof -t -i:9112)",
"pretest:e2e": "yarn run test:server && node_modules/protractor/bin/webdriver-manager update --standalone chrome --gecko false && wait-on --delay 500 --interval 500 http://localhost:9112",
"dev": "yarn run start:dev",
"dist": "webpack-dev-server -d --config webpack.prod.js",
"start": "yarn run start:dist",
"start:dist": "http-server -p 9111 ./dist",
"test:e2e": "node_modules/protractor/bin/protractor --browser chrome test/e2e/conf_e2e.js",
"test:karma": "karma start test/karma/karma.conf.js",
Expand Down

0 comments on commit e89bdfa

Please sign in to comment.