(tokens, text)
| 129 | }; |
| 130 | |
| 131 | const printTokens = (tokens, text) => { |
| 132 | console.log(` ${tokens.length} tokens detected:`); |
| 133 | const firstTokenText = getText(tokens[0].layout.textAnchor, text); |
| 134 | console.log(` First token text: ${JSON.stringify(firstTokenText)}`); |
| 135 | const firstTokenBreakType = tokens[0].detectedBreak.type; |
| 136 | console.log(` First token break type: ${firstTokenBreakType}`); |
| 137 | const lastTokenText = getText( |
| 138 | tokens[tokens.length - 1].layout.textAnchor, |
| 139 | text |
| 140 | ); |
| 141 | console.log(` Last token text: ${JSON.stringify(lastTokenText)}`); |
| 142 | const lastTokenBreakType = tokens[tokens.length - 1].detectedBreak.type; |
| 143 | console.log(` Last token break type: ${lastTokenBreakType}`); |
| 144 | }; |
| 145 | |
| 146 | // Extract shards from the text field |
| 147 | const getText = (textAnchor, text) => { |
no test coverage detected