ruleExtractionSteps (rule, doc) {
    let entities = []
    let findings
    let accepted

    const checkFindings = (findings) => {
      if (!Array.isArray(findings) || findings.length===0) {
        return false
      }

      let items = rule.filterFindings(findings)
      if (!Array.isArray(items) || items.length===0) {
        return false
      }

      items.forEach(item => {
        entities.push( new DataEntity({ rule, props: item }) )
      })
      return true
    }

    accepted = checkFindings(this.extractFromDataMatrix(rule, doc))
    if (!accepted) {
      checkFindings(this.extractUsingBruteForce(rule, doc))
    }

    // accepted or not, return findings
    return entities
  }
/**
   *
   * apply rule in steps using different methods
   *
   */
apply rule in steps using different methods
apply rule in steps using different methods
ruleExtractionSteps (rule, doc) {
    let entities = []
    let findings
    let accepted
    const checkFindings = (findings) => {
      if (!Array.isArray(findings) || findings.length===0) {
        return false
      }
      let items = rule.filterFindings(findings)
      if (!Array.isArray(items) || items.length===0) {
        return false
      }
      items.forEach(item => {
        entities.push( new DataEntity({ rule, props: item }) )
      })
      return true
    }
    accepted = checkFindings(this.extractFromDataMatrix(rule, doc))
    if (!accepted) {
      checkFindings(this.extractUsingBruteForce(rule, doc))
    }
    return entities
  }
ruleExtractionSteps ( rule , doc ) { let entities = [ ] let findings let accepted const checkFindings = ( findings ) => { if ( ! Array . isArray ( findings ) || findings . length === 0 ) { return false } let items = rule . filterFindings ( findings ) if ( ! Array . isArray ( items ) || items . length === 0 ) { return false } items . forEach ( item => { entities . push ( new DataEntity ( { rule , props : item } ) ) } ) return true } accepted = checkFindings ( this . extractFromDataMatrix ( rule , doc ) ) if ( ! accepted ) { checkFindings ( this . extractUsingBruteForce ( rule , doc ) ) } return entities }
apply rule in steps using different methods
apply rule in steps using different methods
// accepted or not, return findings