Skip to main content
. 2017 Aug 14;31(1):84–90. doi: 10.1007/s10278-017-0013-3

Table 3.

Pseudocode with REGEX

FOR each report:
 Initialize REGEX: = 0
 Initialize (REP_POS, REP_NEG): = (0,0)
FOR each of BODY and IMPRESSION sections:
 Initialize (SEC_POS, SEC_NEG): = (0,0)
FOR each sentence:
 Search for base KEYWORD
FOR each KEYWORD:
 Search for EXCLUSION surrounding KEYWORD
 IF at least one KEYWORD = 1 AND EXCLUSION = 1:
 (SEN_POS, SEN_NEG) = (1,1)
 IF at least one KEYWORD = TRUE AND EXCLUSION = 0:
 (SEN_POS, SEN_NEG) = (1,0)
FOR all sentences in section:
 IF at least one (SEN_POS, SEN_NEG) = (1,1):
 (SEC_POS, SEC_NEG) = (1,1)
 IF at least one (SEN_POS, SENE_NEG) = (1,0):
 (SEC_POS, SEC_NEG) = (1,0)
 (REP_POS, REP_NEG):= (REP_POS, REP_NEG) of IMPRESSION
 IF (SEC_POS, SEC_NEG) of IMPRESSION = (0,0):
(REP_POS, REP_NEG):= (SEC_POS, SEC_NEG) of BODY
 IF (REP_POS, REP_NEG) = (1,0)
 REGEX: = 1