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
65e6c15a
Commit
65e6c15a
authored
3 years ago
by
Lange, Dr. Herbert
Browse files
Options
Downloads
Patches
Plain Diff
actual implementation of the checker
parent
317f3ca6
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/EXMARaLDATranscriptionChecker.java
+63
-12
63 additions, 12 deletions
...rpora/validation/quest/EXMARaLDATranscriptionChecker.java
with
63 additions
and
12 deletions
src/main/java/de/uni_hamburg/corpora/validation/quest/EXMARaLDATranscriptionChecker.java
+
63
−
12
View file @
65e6c15a
package
de.uni_hamburg.corpora.validation.quest
;
import
de.uni_hamburg.corpora.CorpusData
;
import
de.uni_hamburg.corpora.EXMARaLDATranscriptionData
;
import
de.uni_hamburg.corpora.*
;
import
org.exmaralda.partitureditor.fsm.FSMException
;
import
org.exmaralda.partitureditor.jexmaralda.JexmaraldaException
;
import
org.jdom.Document
;
import
org.jdom.Element
;
import
org.jdom.JDOMException
;
import
org.jdom.xpath.XPath
;
import
org.xml.sax.SAXException
;
import
java.util.Collection
;
import
java.util.Collections
;
import
java.util.List
;
import
java.util.Properties
;
import
javax.xml.parsers.ParserConfigurationException
;
import
javax.xml.transform.TransformerException
;
import
javax.xml.xpath.XPathExpressionException
;
import
java.io.IOException
;
import
java.net.URISyntaxException
;
import
java.security.NoSuchAlgorithmException
;
import
java.util.*
;
import
java.util.logging.Logger
;
/**
* Checker for transcription data in an EXMARaLDA file
* @author bba1792, Dr. Herbert Lange
* @version 20220516
*/
public
class
EXMARaLDATranscriptionChecker
extends
TranscriptionChecker
{
private
final
Logger
logger
=
Logger
.
getLogger
(
getFunction
());
public
EXMARaLDATranscriptionChecker
(
Properties
properties
)
{
super
(
properties
);
}
@Override
public
Report
function
(
Corpus
c
,
Boolean
fix
)
throws
NoSuchAlgorithmException
,
ClassNotFoundException
,
FSMException
,
URISyntaxException
,
SAXException
,
IOException
,
ParserConfigurationException
,
JexmaraldaException
,
TransformerException
,
XPathExpressionException
,
JDOMException
{
Report
report
=
new
Report
();
// Check if we have a tier pattern. if yes we use the tier finder to get all tier ids
if
(
props
.
containsKey
(
"transcription-tier-pattern"
))
{
// Copy old properties
Properties
newProperties
=
new
Properties
();
newProperties
.
putAll
(
props
);
// convert tier pattern
newProperties
.
put
(
"tier-pattern"
,
props
.
getProperty
(
"transcription-tier-pattern"
));
// run tier finder
EXMARaLDATierFinder
etf
=
new
EXMARaLDATierFinder
(
newProperties
);
report
.
merge
(
etf
.
function
(
c
,
fix
));
tierIds
.
addAll
(
etf
.
getTierList
());
}
report
.
merge
(
super
.
function
(
c
,
fix
));
return
report
;
}
@Override
public
String
getDescription
()
{
return
"Checker for the transcription in an EXMARaLDA transcription file"
;
...
...
@@ -25,12 +61,27 @@ public class EXMARaLDATranscriptionChecker extends TranscriptionChecker {
}
@Override
List
<
Element
>
getTranscriptionTiers
(
CorpusData
cd
)
{
return
null
;
List
<
Element
>
getTranscriptionTiers
(
CorpusData
cd
)
throws
JDOMException
{
List
<
Element
>
tiers
=
new
ArrayList
<>();
Document
dom
=
((
EXMARaLDATranscriptionData
)
cd
).
getJdom
();
// Explicit list of tiers
if
(!
tierIds
.
isEmpty
())
for
(
String
id
:
tierIds
)
{
Element
tier
=
(
Element
)
XPath
.
newInstance
(
String
.
format
(
"//tier[@id=\"%s\"]"
,
id
)).
selectSingleNode
(
dom
);
if
(
tier
!=
null
)
tiers
.
add
(
tier
);
}
// HIAT tiers of category v (verbal)
else
if
(
props
.
containsKey
(
"transcription-method"
)
&&
props
.
getProperty
(
"transcription-method"
).
equalsIgnoreCase
(
"hiat"
))
{
logger
.
info
(
"HIAT"
);
tiers
.
addAll
(
Collections
.
checkedList
(
XPath
.
newInstance
(
"//tier[@category=\"v\"]"
).
selectNodes
(
dom
),
Element
.
class
));
}
return
tiers
;
@Override
String
getTranscriptionText
(
Element
tier
)
{
return
null
;
}
}
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