Skip to content

EXTRACTSCORE

The EXTRACTSCORE function allows you to find out the score of one or more domains in a specified set.

For example, if the workingSet set is populated with these domains from the sample taxonomy in the introduction:

1.02    athletics
1.03    baseball
1.04    football
1.05    gymnastics

with this code:

function onCategorizer() {
   var workingSet = CLONE(ALL);
   var domainScores = EXTRACTSCORE(workingSet);
   CONSOLE.log(JSON.stringify(domainScores))
}

you will get—after an analysis—the scores of all domains in the specified set in the Console tool window, Output tab, in this format:

{domain1Name:domain1Score, domain2Name:domain2Score, domain3Name:domain3Score, domain4Name:domain4Score}

where:

  • domain#Name is the domain name or ID.
  • domain#Score is the domain score.

With this other code:

function onCategorizer() {
   var workingSet = CLONE(ALL);
   var domainScores = EXTRACTSCORE(["1.06", "1.07"]);
   CONSOLE.log(JSON.stringify(domainScores))
}

you will get the scores of the specified domains in the Console tool window, Output tab, with the same format described above.

With this other code instead:

function onCategorizer() {
   var workingSet = CLONE(ALL);
   var domainScores = EXTRACTSCORE(workingSet,["1.10"]);
   CONSOLE.log(JSON.stringify(domainScores))
}

you will get the score of the domain 1.10 belonging to the specified set.

In the first example code, the syntax of the EXTRACTSCORE function is:

EXTRACTSCORE(set)

In the second example code, the syntax is:

EXTRACTSCORE(domainName)

In the third example code, the syntax is:

EXTRACTSCORE(set, [domainName])

where:

  • set is the set variable.
  • domainName is the domain name or ID. It's an array in case of multiple domain names or IDs.

Note

In the third example syntax, domainName is always an array.

The comma in the third example syntax between set and domainName is mandatory.

Warning

Changes to a category score after EXTRACTSCORE has been used will not be automatically reflected in the resulting object. To update the object, you must invoke the function again.