Skip to content

Commit

Permalink
Fixes dbpedia#760: Update regex in duration parser to replace charact…
Browse files Browse the repository at this point in the history
…ers not present in the config file instead of all non latin characters
  • Loading branch information
Meti-Adane committed Jul 31, 2024
1 parent 5547ea8 commit f4bdfbb
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ class DurationParser( context : { def language : Language } ) extends java.io.Se
val durationsMap = TimeValueUnitRegex.findAllIn(input).matchData.map{ m =>
{
// Seconds and minutes could be indicated as ','',"
val unit = timeUnits.get(m.subgroups(1).replaceAll("""[^\'\"a-zA-Z]""", "")).getOrElse(return None) // hack to deal with e.g "min)" matches
val unit = timeUnits.get(m.subgroups(1).replaceAll(s"""[^\'\"${timeUnitsRegex}]""", "")).getOrElse(return None) // hack to deal with e.g "min)" matches
val num = getNum(m).getOrElse(return None)
(unit, num) }
}.toMap
Expand Down

0 comments on commit f4bdfbb

Please sign in to comment.