GazetteerAnnotator extends JCasAnnotator_ImplBase { static List<OverlappingChunk> groupOverlappingChunks(List<Chunk> chunkList, String chunkedText) { Collections.sort(chunkList, new Comparator<Chunk>() { @Override public int compare(Chunk o1, Chunk o2) { return o1.start() - o2.start(); } }); List<OverlappingChunk> overlappingChunks = new ArrayList<OverlappingChunk>(); for (Chunk chunk : chunkList) { boolean added = false; for (OverlappingChunk over : overlappingChunks) { if (over.isOverlappingSpan(chunk.start(), chunk.end())) { over.addChunk(chunk.start(), chunk.end(), chunk); added = true; } } if (!added) { overlappingChunks.add(new OverlappingChunk(chunk.start(), chunk.end(), chunk, chunkedText)); added = true; } } return overlappingChunks; }  void initialize(UimaContext aContext); void process(JCas aJCas); static final String CHUNKER_RESOURCE_NAME; final static String PARAM_CHECK_ACRONYMS; final static String PARAM_OUTPUT_TYPE; }
@Test public void testGroupOvecrlappingChunks() { String chunkedText = "PTH-related peptide (PTHrP) is a secreted protein produced by breast cancer cells both in vivo and in vitro. Because of its structural similarity to PTH at the amino terminus, the two proteins interact with a common cell surface receptor, the PTH/PTHrP receptor. When overproduced by tumor cells, PTHrP enters the circulation, giving rise to the common paraneoplastic syndrome of humoral hypercalcemia of malignancy. Although initially discovered in malignancies, PTHrP is now known to be produced by most cells and tissues in the body. It acts as an autocrine and paracrine mediator of cell proliferation and differentiation, effects which are mediated via the PTH/PTHrP receptor. Recent evidence also has shown that, directly after translation, PTHrP is able to enter the nucleus and/or nucleolus and influence cell cycle progression and apoptosis. In this study, we have either overproduced PTHrP or inhibited endogenous PTHrP production in the breast cancer cell line, MCF-7. Overexpression of PTHrP was associated with an increase in mitogenesis, whereas inhibiting endogenous PTHrP production resulted in decreased cell proliferation. The overexpressed peptide targeted to the perinuclear space. In contrast, PTHrP interaction with the cell surface PTH/PTHrP receptor resulted in decreased cell proliferation in the same cell line. This latter effect is dependent on interaction with the receptor, in that exogenously added PTHrP moieties known not to interact with the receptor had no effect on cell growth. Furthermore, neutralization of added peptide with an anti-PTHrP antiserum completely abolished the growth inhibitory effects. In contrast, this antibody has no effect on the increased proliferation rate of the MCF-7 transfectants that overexpress PTHrP, compared with control cells. The net effect of autocrine/paracrine and intracrine effects of PTHrP in MCF-7 cells overproducing the peptide is accelerated cell growth. These findings have critical implications regarding the role of PTHrP in breast cancer, and they suggest that controlling PTHrP production in breast cancer may be useful therapeutically. "; List<Chunk> chunking = new ArrayList<>(); chunking.add(ChunkFactory.createChunk(662, 665, 0d)); chunking.add(ChunkFactory.createChunk(666, 671, 0d)); chunking.add(ChunkFactory.createChunk(662, 665, 0d)); chunking.add(ChunkFactory.createChunk(662, 665, 0d)); chunking.add(ChunkFactory.createChunk(662, 665, 0d)); chunking.add(ChunkFactory.createChunk(662, 665, 0d)); chunking.add(ChunkFactory.createChunk(662, 665, 0d)); chunking.add(ChunkFactory.createChunk(662, 665, 0d)); chunking.add(ChunkFactory.createChunk(666, 671, 0d)); chunking.add(ChunkFactory.createChunk(662, 665, 0d)); chunking.add(ChunkFactory.createChunk(662, 665, 0d)); chunking.add(ChunkFactory.createChunk(662, 665, 0d)); chunking.add(ChunkFactory.createChunk(666, 671, 0d)); chunking.add(ChunkFactory.createChunk(666, 671, 0d)); chunking.add(ChunkFactory.createChunk(666, 671, 0d)); chunking.add(ChunkFactory.createChunk(662, 665, 0d)); chunking.add(ChunkFactory.createChunk(662, 665, 0d)); chunking.add(ChunkFactory.createChunk(662, 665, 0d)); chunking.add(ChunkFactory.createChunk(666, 671, 0d)); chunking.add(ChunkFactory.createChunk(662, 680, 0d)); List<OverlappingChunk> overlappingChunks = GazetteerAnnotator.groupOverlappingChunks(chunking, chunkedText); Set<Chunk> bestChunks = new HashSet<>(); for (OverlappingChunk overlappingChunk : overlappingChunks) { List<Chunk> bestChunkList = overlappingChunk.getBestChunks(); assertEquals(1, bestChunkList.size()); Chunk bestChunk = bestChunkList.get(0); assertFalse( "Duplicate best chunk: " + bestChunk + " (\"" + chunkedText.subSequence(bestChunk.start(), bestChunk.end()) + "\")", bestChunks.contains(bestChunk)); bestChunks.add(bestChunk); } }