Skip to content

Commit

Permalink
tei-import: Map blank lemmas and pos to null
Browse files Browse the repository at this point in the history
  • Loading branch information
PrinsINT committed Oct 16, 2024
1 parent aed57d4 commit 70a5618
Showing 1 changed file with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -287,10 +287,14 @@ class BLFXMLParser (

// Extraction
val literal = literalExtractor(node).trim() // wordPathExpression.evaluate( node )
val lem = lemmaExtractor(node) // lemPathExpression.evaluate( node )
val pos = posExtractor(node) // posPathExpression.evaluate( node )
var lem: String? = lemmaExtractor(node) // lemPathExpression.evaluate( node )
var pos: String? = posExtractor(node) // posPathExpression.evaluate( node )
val id = idExtractor(node)

// Map empty strings to null
if(lem.isNullOrBlank()) lem = null
if(pos.isNullOrBlank()) pos = null

// Add the word to the source layer
val wordForm = WordForm(literal, trueWordOffset, literal.length, id ?: "no-id" )
val term = Term(lem, pos, mutableListOf(wordForm))
Expand Down

0 comments on commit 70a5618

Please sign in to comment.