Skip to content
Snippets Groups Projects
Commit 6b9b2b8c authored by Lange, Dr. Herbert's avatar Lange, Dr. Herbert
Browse files

add check if function is applicable and some reformating

parent 3a114db7
No related branches found
No related tags found
1 merge request!6add feature to load criteria file from resource and place all criteria files...
......@@ -16,6 +16,7 @@ import java.net.URI;
import java.net.URISyntaxException;
import java.security.NoSuchAlgorithmException;
import java.util.*;
import java.util.logging.Logger;
import java.util.stream.Collectors;
/**
......@@ -25,6 +26,8 @@ import java.util.stream.Collectors;
*/
abstract class TierStructureChecker extends Checker implements CorpusFunction {
Logger logger = Logger.getLogger(this.getClass().toString());
// All tier structures
Map<URI,Set<Map<String,String>>> tierStructure = new HashMap<>();
......@@ -55,9 +58,10 @@ abstract class TierStructureChecker extends Checker implements CorpusFunction {
Report report = new Report();
Set<Map<String,String>> tiers = getTierStructure(report, cd);
tierStructure.put(cd.getURL().toURI(),tiers);
if (individualStructure)
if (individualStructure) {
report.addNote(getFunction(), cd, "All tiers:\n" + tiers.stream().map((o) -> o.toString())
.collect(Collectors.joining("\n")));
}
return report;
}
......@@ -66,6 +70,7 @@ abstract class TierStructureChecker extends Checker implements CorpusFunction {
Report report = new Report();
Set<Map<String,String>> commonTiers = new HashSet<>();
for (CorpusData cd : c.getCorpusData()){
if (getIsUsableFor().contains(cd.getClass())) {
report.merge(function(cd, getCanFix()));
if (commonTiers.isEmpty())
commonTiers.addAll(tierStructure.get(cd.getURL().toURI()));
......@@ -74,6 +79,7 @@ abstract class TierStructureChecker extends Checker implements CorpusFunction {
Sets.intersection(commonTiers, tierStructure.get(cd.getURL().toURI()))
.stream().collect(Collectors.toSet());
}
}
for (URI file : tierStructure.keySet()) {
Sets.SetView<Map<String,String>> missingTiers = Sets.difference(tierStructure.get(file),commonTiers);
report.addWarning(getFunction(), ReportItem.newParamMap(
......@@ -85,7 +91,7 @@ abstract class TierStructureChecker extends Checker implements CorpusFunction {
}
if (sharedStructure)
report.addNote(getFunction(),commonTiers.stream().map((o) -> o.toString())
report.addNote(getFunction(),"Common tiers: " + commonTiers.stream().map((o) -> o.toString())
.collect(Collectors.joining("\n")));
return report;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment