@Test public void canCreateDocumentWithText() throws UIMAException { JCas jCas = JCasFactory.createJCas(); String text = "test"; jCas.setDocumentText(text); DocumentFactory documentFactory = new DocumentFactory(jCas, sentenceFactory); Document document = documentFactory.create(); assertEquals(text, document.text().get()); }
public OdinDocument create() { OdinDocument document = new OdinDocument(sentenceFactory.create()); document.text_$eq(Some.apply(jCas.getDocumentText())); int chainId = 0; List<CorefMention> mentions = new ArrayList<>(); for (Entry<ReferenceTarget, Collection<Entity>> coref : referentMap.asMap().entrySet()) { for (Entity entity : coref.getValue()) { Collection<Sentence> collection = entityIndex.get(entity); if (!collection.isEmpty()) { OdinSentence sentence = document.findSentence(collection.iterator().next()); mentions.add(sentence.corefMention(entity, chainId)); } } chainId++; } CorefChains chains = CorefChains.apply(JavaConversions.iterableAsScalaIterable(mentions)); document.coreferenceChains_$eq(Option.apply(chains)); return document; }
DocumentFactory { public OdinDocument create() { OdinDocument document = new OdinDocument(sentenceFactory.create()); document.text_$eq(Some.apply(jCas.getDocumentText())); int chainId = 0; List<CorefMention> mentions = new ArrayList<>(); for (Entry<ReferenceTarget, Collection<Entity>> coref : referentMap.asMap().entrySet()) { for (Entity entity : coref.getValue()) { Collection<Sentence> collection = entityIndex.get(entity); if (!collection.isEmpty()) { OdinSentence sentence = document.findSentence(collection.iterator().next()); mentions.add(sentence.corefMention(entity, chainId)); } } chainId++; } CorefChains chains = CorefChains.apply(JavaConversions.iterableAsScalaIterable(mentions)); document.coreferenceChains_$eq(Option.apply(chains)); return document; } }
DocumentFactory { public OdinDocument create() { OdinDocument document = new OdinDocument(sentenceFactory.create()); document.text_$eq(Some.apply(jCas.getDocumentText())); int chainId = 0; List<CorefMention> mentions = new ArrayList<>(); for (Entry<ReferenceTarget, Collection<Entity>> coref : referentMap.asMap().entrySet()) { for (Entity entity : coref.getValue()) { Collection<Sentence> collection = entityIndex.get(entity); if (!collection.isEmpty()) { OdinSentence sentence = document.findSentence(collection.iterator().next()); mentions.add(sentence.corefMention(entity, chainId)); } } chainId++; } CorefChains chains = CorefChains.apply(JavaConversions.iterableAsScalaIterable(mentions)); document.coreferenceChains_$eq(Option.apply(chains)); return document; } DocumentFactory(JCas jCas);  DocumentFactory(JCas jCas, SentenceFactory sentenceFactory);  DocumentFactory(
      JCas jCas,
      Map<Entity, List<Sentence>> entityIndex,
      Multimap<ReferenceTarget, Entity> referentMap,
      SentenceFactory sentenceFactory); }
DocumentFactory { public OdinDocument create() { OdinDocument document = new OdinDocument(sentenceFactory.create()); document.text_$eq(Some.apply(jCas.getDocumentText())); int chainId = 0; List<CorefMention> mentions = new ArrayList<>(); for (Entry<ReferenceTarget, Collection<Entity>> coref : referentMap.asMap().entrySet()) { for (Entity entity : coref.getValue()) { Collection<Sentence> collection = entityIndex.get(entity); if (!collection.isEmpty()) { OdinSentence sentence = document.findSentence(collection.iterator().next()); mentions.add(sentence.corefMention(entity, chainId)); } } chainId++; } CorefChains chains = CorefChains.apply(JavaConversions.iterableAsScalaIterable(mentions)); document.coreferenceChains_$eq(Option.apply(chains)); return document; } DocumentFactory(JCas jCas);  DocumentFactory(JCas jCas, SentenceFactory sentenceFactory);  DocumentFactory(
      JCas jCas,
      Map<Entity, List<Sentence>> entityIndex,
      Multimap<ReferenceTarget, Entity> referentMap,
      SentenceFactory sentenceFactory); OdinDocument create(); }
DocumentFactory { public OdinDocument create() { OdinDocument document = new OdinDocument(sentenceFactory.create()); document.text_$eq(Some.apply(jCas.getDocumentText())); int chainId = 0; List<CorefMention> mentions = new ArrayList<>(); for (Entry<ReferenceTarget, Collection<Entity>> coref : referentMap.asMap().entrySet()) { for (Entity entity : coref.getValue()) { Collection<Sentence> collection = entityIndex.get(entity); if (!collection.isEmpty()) { OdinSentence sentence = document.findSentence(collection.iterator().next()); mentions.add(sentence.corefMention(entity, chainId)); } } chainId++; } CorefChains chains = CorefChains.apply(JavaConversions.iterableAsScalaIterable(mentions)); document.coreferenceChains_$eq(Option.apply(chains)); return document; } DocumentFactory(JCas jCas);  DocumentFactory(JCas jCas, SentenceFactory sentenceFactory);  DocumentFactory(
      JCas jCas,
      Map<Entity, List<Sentence>> entityIndex,
      Multimap<ReferenceTarget, Entity> referentMap,
      SentenceFactory sentenceFactory); OdinDocument create();  }