Skip to content

Commit

Permalink
configurable labels
Browse files Browse the repository at this point in the history
  • Loading branch information
lgessler committed Jun 15, 2022
1 parent 2bfe96b commit 43f5979
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 112 deletions.
114 changes: 2 additions & 112 deletions src/ud-tree/ud-tree/vocabs.js
Original file line number Diff line number Diff line change
@@ -1,117 +1,7 @@
export function getXpos(languageCode) {
if (languageCode === "en") {
return [
"CC",
"CD",
"DT",
"EX",
"FW",
"HYPH",
"IN",
"IN/that",
"JJ",
"JJR",
"JJS",
"LS",
"MD",
"NN",
"NNS",
"NP",
"NPS",
"PDT",
"POS",
"PP",
"PP$",
"RB",
"RBR",
"RBS",
"RP",
"SENT",
"SYM",
"TO",
"UH",
"VB",
"VBD",
"VBG",
"VBN",
"VBP",
"VBZ",
"VH",
"VHD",
"VHG",
"VHN",
"VHP",
"VHZ",
"VV",
"VVD",
"VVG",
"VVN",
"VVP",
"VVZ",
"WDT",
"WP",
"WP$",
"WRB",
"``",
"\'\'",
"(",
")",
",",
":"
].sort()
}
return XPOS_LABELS
}

export function getDeprel(languageCode) {
if (languageCode === "en") {
return [
"nsubj",
"csubj",
"nsubj:pass",
"csubj:pass",
"obj",
"ccomp",
"xcomp",
"iobj",
"advcl",
"advmod",
"neg",
"nmod:npmod",
"nmod:tmod",
"nmod:poss",
"vocative",
"aux",
"mark",
"discourse",
"auxpass",
"expl",
"cop",
"nummod",
"acl",
"amod",
"acl:relcl",
"appos",
"det",
"det:predet",
"nmod",
"compound",
"fixed",
"goeswith",
"compound:prt",
"flat",
"foreign",
"conj",
"cc",
"punct",
"cc:preconj",
"case",
"list",
"parataxis",
"orphan",
"dislocated",
"reparandum",
"root",
"dep"
].sort()
}
return DEPREL_LABELS
}
10 changes: 10 additions & 0 deletions webpack.dev.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@

const HtmlWebpackPlugin = require('html-webpack-plugin')
const webpack = require('webpack')
const XPOS_LABELS = ["CC", "CD", "DT", "EX", "FW", "HYPH", "IN", "IN/that", "JJ", "JJR", "JJS", "LS", "MD", "NN",
"NNS", "NP", "NPS", "PDT", "POS", "PP", "PP$", "RB", "RBR", "RBS", "RP", "SENT", "SYM", "TO", "UH", "VB", "VBD", "VBG", "VBN", "VBP",
"VBZ", "VH", "VHD", "VHG", "VHN", "VHP", "VHZ", "VV", "VVD", "VVG", "VVN", "VVP", "VVZ", "WDT", "WP", "WP$", "WRB", "``", "\'\'", "(", ")", ",", ":"]
.map(x => JSON.stringify(x))
const DEPREL_LABELS = [ "nsubj", "obj", "iobj", "csubj", "ccomp", "xcomp", "obl", "vocative", "expl", "dislocated",
"advcl", "advmod", "discourse", "aux", "cop", "mark", "nmod", "appos", "nummod", "acl", "amod", "det", "clf", "case",
"conj", "cc", "fixed", "flat", "compound", "list", "parataxis", "orphan", "goeswith", "reparandum", "punct", "root", "dep"]
.map(x => JSON.stringify(x))

module.exports = {

Expand Down Expand Up @@ -75,6 +83,8 @@ module.exports = {
// The probability under which a label probability provided by an NLP service is viewed as
// "suspicious" by the UI. Suspicious labels are graphically indicated as such in the UI.
SUSPICIOUS_PROBABILITY_THRESHOLD: 0.9,
XPOS_LABELS: XPOS_LABELS,
DEPREL_LABELS: DEPREL_LABELS,
}),
new HtmlWebpackPlugin({
template: './src/page-document/tmpl.html',
Expand Down
11 changes: 11 additions & 0 deletions webpack.prod.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,15 @@ const TerserPlugin = require('terser-webpack-plugin')

const buildPath = path.resolve(__dirname, 'dist')

const XPOS_LABELS = ["CC", "CD", "DT", "EX", "FW", "HYPH", "IN", "IN/that", "JJ", "JJR", "JJS", "LS", "MD", "NN",
"NNS", "NP", "NPS", "PDT", "POS", "PP", "PP$", "RB", "RBR", "RBS", "RP", "SENT", "SYM", "TO", "UH", "VB", "VBD", "VBG", "VBN", "VBP",
"VBZ", "VH", "VHD", "VHG", "VHN", "VHP", "VHZ", "VV", "VVD", "VVG", "VVN", "VVP", "VVZ", "WDT", "WP", "WP$", "WRB", "``", "\'\'", "(", ")", ",", ":"]
.map(x => JSON.stringify(x))
const DEPREL_LABELS = [ "nsubj", "obj", "iobj", "csubj", "ccomp", "xcomp", "obl", "vocative", "expl", "dislocated",
"advcl", "advmod", "discourse", "aux", "cop", "mark", "nmod", "appos", "nummod", "acl", "amod", "det", "clf", "case",
"conj", "cc", "fixed", "flat", "compound", "list", "parataxis", "orphan", "goeswith", "reparandum", "punct", "root", "dep"]
.map(x => JSON.stringify(x))

module.exports = {

// https://webpack.js.org/configuration/mode/
Expand Down Expand Up @@ -84,6 +93,8 @@ module.exports = {
// The probability under which a label probability provided by an NLP service is viewed as
// "suspicious" by the UI. Suspicious labels are graphically indicated as such in the UI.
SUSPICIOUS_PROBABILITY_THRESHOLD: 0.9,
XPOS_LABELS: XPOS_LABELS,
DEPREL_LABELS: DEPREL_LABELS,
}),
new HtmlWebpackPlugin({
template: './src/page-document/tmpl.html',
Expand Down

0 comments on commit 43f5979

Please sign in to comment.