Research Article
A Lightweight API-Based Approach for Building Flexible Clinical NLP Systems
Algorithm 1
Pseudocode of the API integration algorithm.
| Input: X = [X1, X2, …, Xn]: returns of n APIs; | | W = [ω1, ω2, …, ωn]: weights of n APIs; | | γ: similarity threshold; | | θ: extractor threshold; | | Output: T: a list of clinical terms | | Initialisation: ωα = 0.25 and ωβ = 0.75 | | Filter out same/similar terms extracted by one API | (1) | for i = 1 to n do | (2) | for xa in Xido | (3) | Get the rest of terms: Xj = Xi − Xa | (4) | for xb in Xjdo | (5) | calculate the percentage of equal terms over all 10 terms: α | (6) | calculate the percentage of equal terms over top 3 terms: β | (7) | calculate the pairwise similarity: | (8) | if δ ≥ γ then | (9) | discard same/similar term: Xi = Xi − Xb | (10) | end if | (11) | end for | (12) | end for | (13) | end for | (14) | Get filtered arrays of terms: Xδ = [X1δ, X2δ, …, Xnδ] | Filter out extracted terms by the weights over all APIs | (15) | Compute weights over all APIs: Xω = | (16) | for ωsum, x in Xωdo | (17) | if ωsum ≥ θ then | (18) | Add the term the final list: T+ = [x] | (19) | end if | (20) | end for | (21) | return T |
|