Skip to content

Commit

Permalink
Fix #3: Add string deduplication function to circumvent the bug in Zorba
Browse files Browse the repository at this point in the history
  • Loading branch information
scriptin committed Jun 25, 2017
1 parent daf7de6 commit b5ca4b6
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/tags.xq
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,18 @@ module namespace tags = "tags";

(: This file is generated, do not edit manually! :)

declare function tags:deduplicate($text as xs:string) as xs:string? {
let $len := string-length($text) div 2
let $fst := substring($text, 1, $len)
let $snd := substring($text, $len+1)
return if ($fst = $snd) then $fst else $text
};

declare function tags:convert-entity($word-id as xs:string, $text as xs:string) as xs:string? {
tags:convert-entity-normalized($word-id, tags:deduplicate(normalize-space($text)))
};

declare function tags:convert-entity-normalized($word-id as xs:string, $text as xs:string) as xs:string? {
switch($text)
case "martial arts term" return "MA"
case "rude or X-rated term (not displayed in educational software)" return "X"
Expand Down

0 comments on commit b5ca4b6

Please sign in to comment.