Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
corpus-services
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Lange, Dr. Herbert
corpus-services
Commits
317f3ca6
Commit
317f3ca6
authored
3 years ago
by
Lange, Dr. Herbert
Browse files
Options
Downloads
Patches
Plain Diff
better check for problems
parent
743ea00e
No related branches found
No related tags found
1 merge request
!6
add feature to load criteria file from resource and place all criteria files...
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/main/java/de/uni_hamburg/corpora/validation/quest/EXMARaLDAValidatorChecker.java
+22
-4
22 additions, 4 deletions
...g/corpora/validation/quest/EXMARaLDAValidatorChecker.java
with
22 additions
and
4 deletions
src/main/java/de/uni_hamburg/corpora/validation/quest/EXMARaLDAValidatorChecker.java
+
22
−
4
View file @
317f3ca6
...
@@ -21,6 +21,7 @@ import java.nio.file.Paths;
...
@@ -21,6 +21,7 @@ import java.nio.file.Paths;
import
java.security.NoSuchAlgorithmException
;
import
java.security.NoSuchAlgorithmException
;
import
java.util.*
;
import
java.util.*
;
import
java.util.logging.Logger
;
import
java.util.logging.Logger
;
import
java.util.stream.Collectors
;
/**
/**
...
@@ -46,6 +47,7 @@ public class EXMARaLDAValidatorChecker extends Checker implements CorpusFunction
...
@@ -46,6 +47,7 @@ public class EXMARaLDAValidatorChecker extends Checker implements CorpusFunction
@Override
@Override
public
Report
function
(
CorpusData
cd
,
Boolean
fix
)
throws
NoSuchAlgorithmException
,
ClassNotFoundException
,
FSMException
,
URISyntaxException
,
SAXException
,
IOException
,
ParserConfigurationException
,
JexmaraldaException
,
TransformerException
,
XPathExpressionException
,
JDOMException
{
public
Report
function
(
CorpusData
cd
,
Boolean
fix
)
throws
NoSuchAlgorithmException
,
ClassNotFoundException
,
FSMException
,
URISyntaxException
,
SAXException
,
IOException
,
ParserConfigurationException
,
JexmaraldaException
,
TransformerException
,
XPathExpressionException
,
JDOMException
{
logger
.
info
(
"Running function"
);
logger
.
info
(
"Running function"
);
boolean
problem
=
false
;
Report
report
=
new
Report
();
Report
report
=
new
Report
();
URL
fileUri
=
Paths
.
get
(
cd
.
getURL
().
toURI
()).
toAbsolutePath
().
toUri
().
toURL
();
URL
fileUri
=
Paths
.
get
(
cd
.
getURL
().
toURI
()).
toAbsolutePath
().
toUri
().
toURL
();
BasicTranscription
bt
=
new
BasicTranscription
();
BasicTranscription
bt
=
new
BasicTranscription
();
...
@@ -53,6 +55,7 @@ public class EXMARaLDAValidatorChecker extends Checker implements CorpusFunction
...
@@ -53,6 +55,7 @@ public class EXMARaLDAValidatorChecker extends Checker implements CorpusFunction
bt
.
BasicTranscriptionFromJDOMDocument
(((
EXMARaLDATranscriptionData
)
cio
.
readFileURL
(
fileUri
)).
getJdom
());
bt
.
BasicTranscriptionFromJDOMDocument
(((
EXMARaLDATranscriptionData
)
cio
.
readFileURL
(
fileUri
)).
getJdom
());
String
[]
duplicateTranscriptionTiers
=
bt
.
getDuplicateTranscriptionTiers
();
String
[]
duplicateTranscriptionTiers
=
bt
.
getDuplicateTranscriptionTiers
();
if
(
duplicateTranscriptionTiers
.
length
>
0
)
{
if
(
duplicateTranscriptionTiers
.
length
>
0
)
{
problem
=
true
;
report
.
addCritical
(
getFunction
(),
report
.
addCritical
(
getFunction
(),
ReportItem
.
newParamMap
(
new
String
[]{
"function"
,
"filename"
,
"description"
},
ReportItem
.
newParamMap
(
new
String
[]{
"function"
,
"filename"
,
"description"
},
new
String
[]{
getFunction
(),
cd
.
getFilename
(),
"Duplicate transcription tiers: "
+
String
.
join
(
new
String
[]{
getFunction
(),
cd
.
getFilename
(),
"Duplicate transcription tiers: "
+
String
.
join
(
...
@@ -60,6 +63,7 @@ public class EXMARaLDAValidatorChecker extends Checker implements CorpusFunction
...
@@ -60,6 +63,7 @@ public class EXMARaLDAValidatorChecker extends Checker implements CorpusFunction
}
}
String
[]
orphanedTranscriptionTiers
=
bt
.
getOrphanedTranscriptionTiers
();
String
[]
orphanedTranscriptionTiers
=
bt
.
getOrphanedTranscriptionTiers
();
if
(
orphanedTranscriptionTiers
.
length
>
0
)
{
if
(
orphanedTranscriptionTiers
.
length
>
0
)
{
problem
=
true
;
report
.
addWarning
(
getFunction
(),
report
.
addWarning
(
getFunction
(),
ReportItem
.
newParamMap
(
new
String
[]{
"function"
,
"filename"
,
"description"
},
ReportItem
.
newParamMap
(
new
String
[]{
"function"
,
"filename"
,
"description"
},
new
String
[]{
getFunction
(),
cd
.
getFilename
(),
"Orphaned transcription tiers: "
+
String
.
join
(
new
String
[]{
getFunction
(),
cd
.
getFilename
(),
"Orphaned transcription tiers: "
+
String
.
join
(
...
@@ -67,6 +71,7 @@ public class EXMARaLDAValidatorChecker extends Checker implements CorpusFunction
...
@@ -67,6 +71,7 @@ public class EXMARaLDAValidatorChecker extends Checker implements CorpusFunction
}
}
String
[]
orphanedAnnotationTiers
=
bt
.
getOrphanedAnnotationTiers
();
String
[]
orphanedAnnotationTiers
=
bt
.
getOrphanedAnnotationTiers
();
if
(
orphanedAnnotationTiers
.
length
>
0
)
{
if
(
orphanedAnnotationTiers
.
length
>
0
)
{
problem
=
true
;
report
.
addWarning
(
getFunction
(),
report
.
addWarning
(
getFunction
(),
ReportItem
.
newParamMap
(
new
String
[]{
"function"
,
"filename"
,
"description"
},
ReportItem
.
newParamMap
(
new
String
[]{
"function"
,
"filename"
,
"description"
},
new
String
[]{
getFunction
(),
cd
.
getFilename
(),
"Orphaned annotation tiers: "
+
String
.
join
(
new
String
[]{
getFunction
(),
cd
.
getFilename
(),
"Orphaned annotation tiers: "
+
String
.
join
(
...
@@ -74,6 +79,7 @@ public class EXMARaLDAValidatorChecker extends Checker implements CorpusFunction
...
@@ -74,6 +79,7 @@ public class EXMARaLDAValidatorChecker extends Checker implements CorpusFunction
}
}
String
[]
inconsistencies
=
bt
.
getBody
().
getCommonTimeline
().
getInconsistencies
();
String
[]
inconsistencies
=
bt
.
getBody
().
getCommonTimeline
().
getInconsistencies
();
if
(
inconsistencies
.
length
>
0
)
{
if
(
inconsistencies
.
length
>
0
)
{
problem
=
true
;
report
.
addCritical
(
getFunction
(),
report
.
addCritical
(
getFunction
(),
ReportItem
.
newParamMap
(
new
String
[]{
"function"
,
"filename"
,
"description"
},
ReportItem
.
newParamMap
(
new
String
[]{
"function"
,
"filename"
,
"description"
},
new
String
[]{
getFunction
(),
cd
.
getFilename
(),
new
String
[]{
getFunction
(),
cd
.
getFilename
(),
...
@@ -81,18 +87,30 @@ public class EXMARaLDAValidatorChecker extends Checker implements CorpusFunction
...
@@ -81,18 +87,30 @@ public class EXMARaLDAValidatorChecker extends Checker implements CorpusFunction
","
,
inconsistencies
)}));
","
,
inconsistencies
)}));
}
}
Hashtable
<
String
,
String
[]>
annotationMismatches
=
bt
.
getAnnotationMismatches
();
Hashtable
<
String
,
String
[]>
annotationMismatches
=
bt
.
getAnnotationMismatches
();
if
(!
annotationMismatches
.
isEmpty
())
// Only check tiers where we have a non-empty list in the map
Set
<
String
>
missmatchTiers
=
annotationMismatches
.
keySet
().
stream
().
filter
((
k
)
->
annotationMismatches
.
get
(
k
).
length
!=
0
).
collect
(
Collectors
.
toSet
());
if
(!
missmatchTiers
.
isEmpty
())
{
problem
=
true
;
report
.
addCritical
(
getFunction
(),
ReportItem
.
newParamMap
(
new
String
[]{
"function"
,
"filename"
,
"description"
},
report
.
addCritical
(
getFunction
(),
ReportItem
.
newParamMap
(
new
String
[]{
"function"
,
"filename"
,
"description"
},
new
String
[]{
getFunction
(),
cd
.
getFilename
(),
"Annotation mismatch in tiers: "
+
String
.
join
(
","
,
new
String
[]{
getFunction
(),
cd
.
getFilename
(),
"Annotation mismatch in tiers: "
+
String
.
join
(
","
,
annotationMismatches
.
keySet
())}));
missmatchTiers
)}));
}
Vector
segmentationErrors
=
new
HIATSegmentation
().
getSegmentationErrors
(
bt
);
Vector
segmentationErrors
=
new
HIATSegmentation
().
getSegmentationErrors
(
bt
);
// TODO the exact reason and form of segmentation errors is not clear
// TODO the exact reason and form of segmentation errors is not clear
if
(!
segmentationErrors
.
isEmpty
())
{
if
(!
segmentationErrors
.
isEmpty
())
{
problem
=
true
;
for
(
Object
o
:
segmentationErrors
)
{
for
(
Object
o
:
segmentationErrors
)
{
report
.
addCritical
(
getFunction
(),
ReportItem
.
newParamMap
(
new
String
[]{
"function"
,
"filename"
,
"description"
},
report
.
addCritical
(
getFunction
(),
ReportItem
.
newParamMap
(
new
String
[]{
"function"
,
"filename"
,
"description"
},
new
String
[]{
getFunction
(),
cd
.
getFilename
(),
"HIAT Segmentation error: "
+
o
.
toString
()}));
new
String
[]{
getFunction
(),
cd
.
getFilename
(),
"HIAT Segmentation error: "
+
o
.
toString
()}));
}
}
}
}
if
(!
problem
)
{
report
.
addCorrect
(
getFunction
(),
ReportItem
.
newParamMap
(
new
String
[]{
"function"
,
"filename"
,
"description"
},
new
Object
[]{
getFunction
(),
cd
.
getFilename
(),
"No problems found in file"
}
));
}
return
report
;
return
report
;
}
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment