Skip to content

Commit

Permalink
--print-members option to print labels of entities in groupings with …
Browse files Browse the repository at this point in the history
…explanations in normal output mode
  • Loading branch information
reality committed Jun 9, 2021
1 parent 38ac83f commit 1569f94
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 6 deletions.
2 changes: 1 addition & 1 deletion klarigi/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -78,4 +78,4 @@ jacocoTestReport {
}
}

version = '0.0.5'
version = '0.0.6'
5 changes: 3 additions & 2 deletions klarigi/src/main/groovy/klarigi/App.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ class App {

_ longOpt: 'latex', 'Output the results in LaTeX table format', type: Boolean
_ longOpt: 'output', 'File to output results to. If not given, will print to stdout', args: 1
_ longOpt: 'print-members', 'Print members of groups by label (first column of data file). Only works with standard output (not LaTeX)', type: Boolean

_ longOpt: 'verbose', 'Verbose output, mostly progress', type: Boolean, args: 0
}
Expand All @@ -58,11 +59,11 @@ class App {
def k = new Klarigi(o)
if(!o['group'] || (o['group'] && o['group'] == '*')) {
k.explainAllClusters(o['output-scores']).each {
k.output(it.cluster, it.results, o['latex'], o['output'])
k.output(it.cluster, it.results, o['latex'], o['print-members'], o['output'])
}
} else {
def r = k.explainCluster(o['group'], o['output-scores'])
k.output(o['group'], r, o['latex'], o['output'])
k.output(o['group'], r, o['latex'], o['print-members'], o['output'])
}
}
}
4 changes: 2 additions & 2 deletions klarigi/src/main/groovy/klarigi/Klarigi.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -158,12 +158,12 @@ public class Klarigi {
}
}

def output(cid, results, latex, toFile) {
def output(cid, results, latex, printMembers, toFile) {
def cSize = data.groupings[cid].size()
if(latex) {
StepDown.PrintLaTeX(cid, results, ontoHelper.labels, cSize, toFile)
} else {
StepDown.Print(cid, results, ontoHelper.labels, cSize, toFile)
StepDown.Print(cid, results, ontoHelper.labels, cSize, toFile, data.groupings[cid], printMembers)
}
}

Expand Down
5 changes: 4 additions & 1 deletion klarigi/src/main/groovy/klarigi/StepDown.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,13 @@ public class StepDown {
return stepDown(candidates, c.MAX_IC, c.MAX_EXCLUSION, c.MAX_INCLUSION, c.MAX_TOTAL_INCLUSION)
}

static def Print(cid, res, labels, s, toFile) {
static def Print(cid, res, labels, s, toFile, members, printMembers) {
def out = []
out << "----------------"
out << "Group: $cid ($s members)"
if(printMembers) {
out << "Members: " + members.join(', ')
}
out << "Overall inclusion: ${res[1]}%"
out << "Explanatory classes:"
res[0].each { z ->
Expand Down

0 comments on commit 1569f94

Please sign in to comment.