Tabnine Logo
Quantity.<init>
Code IndexAdd Tabnine to your IDE (free)

How to use
uk.gov.dstl.baleen.types.common.Quantity
constructor

Best Java code snippets using uk.gov.dstl.baleen.types.common.Quantity.<init> (Showing top 13 results out of 315)

origin: dstl/baleen

 return Optional.of(new Person(jCas));
case "Quantity":
 return Optional.of(new Quantity(jCas));
case "Temporal":
 return Optional.of(new Temporal(jCas));
origin: uk.gov.dstl.baleen/baleen-collectionreaders

 return Optional.of(new Person(jCas));
case "Quantity":
 return Optional.of(new Quantity(jCas));
case "Temporal":
 return Optional.of(new Temporal(jCas));
origin: dstl/baleen

@Test
public void testQuantityPeople() throws Exception {
 jCas.setDocumentText("47,000 people voted in an independence referendum");
 Quantity n = new Quantity(jCas, 0, 6);
 n.addToIndexes();
 processJCas();
 assertEquals(0, JCasUtil.select(jCas, Quantity.class).size());
 assertEquals(1, JCasUtil.select(jCas, Organisation.class).size());
 assertEquals(
   "47,000 people", JCasUtil.selectByIndex(jCas, Organisation.class, 0).getCoveredText());
}
origin: dstl/baleen

 @Test
 public void testQuantityPeopleKeepOriginal() throws Exception {
  jCas.setDocumentText("47,000 people voted in an independence referendum");

  Quantity n = new Quantity(jCas, 0, 6);
  n.addToIndexes();

  processJCas(People.PARAM_REMOVE_ORIGINAL, false);

  assertEquals(1, JCasUtil.select(jCas, Quantity.class).size());
  assertEquals("47,000", JCasUtil.selectByIndex(jCas, Quantity.class, 0).getCoveredText());
  assertEquals(1, JCasUtil.select(jCas, Organisation.class).size());
  assertEquals(
    "47,000 people", JCasUtil.selectByIndex(jCas, Organisation.class, 0).getCoveredText());
 }
}
origin: dstl/baleen

 @Override
 public void map(JCas jCas, Element element, AnnotationCollector collector) {
  switch (element.tagName().toLowerCase()) {
   case "time":
    collector.add(new Temporal(jCas));
    break;
   case "meter":
    collector.add(new Quantity(jCas));
    break;
   case "dfn":
    collector.add(new Buzzword(jCas));
    break;
   case "address":
    collector.add(new Location(jCas));
    break;
   case "abbr":
    collector.add(new Buzzword(jCas));
    break;
   case "cite":
    collector.add(new DocumentReference(jCas));
    break;

   default:
    return;
  }
 }
}
origin: uk.gov.dstl.baleen/baleen-collectionreaders

 @Override
 public void map(JCas jCas, Element element, AnnotationCollector collector) {
  switch (element.tagName().toLowerCase()) {
   case "time":
    collector.add(new Temporal(jCas));
    break;
   case "meter":
    collector.add(new Quantity(jCas));
    break;
   case "dfn":
    collector.add(new Buzzword(jCas));
    break;
   case "address":
    collector.add(new Location(jCas));
    break;
   case "abbr":
    collector.add(new Buzzword(jCas));
    break;
   case "cite":
    collector.add(new DocumentReference(jCas));
    break;

   default:
    return;
  }
 }
}
origin: dstl/baleen

@Test
public void test() throws UIMAException {
 jCas.setDocumentText("The weapons were found 50 miles south-west of London");
 Quantity q = new Quantity(jCas);
 q.setBegin(23);
 q.setEnd(31);
 q.setSubType("distance");
 q.addToIndexes();
 Location l = new Location(jCas, 46, 52);
 l.addToIndexes();
 processJCas();
 assertEquals("50 miles south-west of London", l.getCoveredText());
 assertEquals(1, JCasUtil.select(jCas, Quantity.class).size());
}
origin: dstl/baleen

@Test
public void testRemoveQuantity() throws UIMAException {
 jCas.setDocumentText("The weapons were found 20 miles north of London");
 Quantity q = new Quantity(jCas);
 q.setBegin(23);
 q.setEnd(31);
 q.setSubType("distance");
 q.addToIndexes();
 Location l = new Location(jCas, 41, 47);
 l.addToIndexes();
 processJCas(ExpandLocationToDescription.PARAM_REMOVE_QUANTITY, true);
 assertEquals("20 miles north of London", l.getCoveredText());
 assertEquals(0, JCasUtil.select(jCas, Quantity.class).size());
}
origin: dstl/baleen

d3.addToIndexes();
Quantity q1 = new Quantity(jCas, 153, 156);
q1.addToIndexes();
Quantity q2 = new Quantity(jCas, 167, 170);
q2.addToIndexes();
origin: dstl/baleen

 @Test
 public void testMarked() throws UIMAException {
  Quantity q = new Quantity(jCas);
  q.setBegin(18);
  q.setEnd(21);
  q.addToIndexes();

  Buzzword e = new Buzzword(jCas);
  e.setBegin(25);
  e.setEnd(36);
  e.addToIndexes();

  processJCas();

  assertEquals(2, JCasUtil.select(jCas, Entity.class).size());

  assertEquals(1, JCasUtil.select(jCas, Relation.class).size());
  Relation r = JCasUtil.selectByIndex(jCas, Relation.class, 0);
  assertEquals(18, r.getBegin());
  assertEquals(q, r.getSource());
  assertEquals(36, e.getEnd());
  assertEquals(e, r.getTarget());
  assertEquals("QUANTITY", r.getRelationshipType());
 }
}
origin: dstl/baleen

@Test
public void testUnmarked() throws UIMAException {
 Quantity q = new Quantity(jCas);
 q.setBegin(18);
 q.setEnd(21);
 q.addToIndexes();
 processJCas();
 assertAnnotations(2, Entity.class, new TestEntity<>(1, "blue powder"));
 assertEquals(1, JCasUtil.select(jCas, Relation.class).size());
 Relation r = JCasUtil.selectByIndex(jCas, Relation.class, 0);
 assertEquals(18, r.getBegin());
 assertEquals(q, r.getSource());
 assertEquals(36, r.getEnd());
 assertNotNull(r.getTarget());
 assertEquals("QUANTITY", r.getRelationshipType());
}
origin: dstl/baleen

public static Quantity createDistanceQuantity(
  JCas jCas,
  int begin,
  int end,
  String value,
  int quantity,
  String unit,
  double normalizedQuantity) {
 Quantity q = new Quantity(jCas);
 q.setBegin(begin);
 q.setEnd(end);
 q.setConfidence(1.0);
 q.setValue(value);
 q.setQuantity(quantity);
 q.setUnit(unit);
 q.setNormalizedQuantity(normalizedQuantity);
 q.setNormalizedUnit("m");
 q.setSubType("length");
 q.addToIndexes();
 return q;
}
origin: dstl/baleen

public static Quantity createWeightQuantity(
  JCas jCas,
  int begin,
  int end,
  String value,
  double quantity,
  String unit,
  double normalizedQuantity) {
 Quantity q = new Quantity(jCas);
 q.setBegin(begin);
 q.setEnd(end);
 q.setConfidence(1.0);
 q.setValue(value);
 q.setQuantity(quantity);
 q.setUnit(unit);
 q.setNormalizedQuantity(normalizedQuantity);
 q.setNormalizedUnit("kg");
 q.setSubType(WEIGHT);
 q.addToIndexes();
 return q;
}
uk.gov.dstl.baleen.types.commonQuantity<init>

Javadoc

Never called. Disable default constructor

Popular methods of Quantity

  • addToIndexes
  • setBegin
  • setEnd
  • getBegin
  • getCoveredText
  • getEnd
  • getNormalizedQuantity
    getter for normalizedQuantity - gets The normalized quantity
  • getNormalizedUnit
    getter for normalizedUnit - gets The unit of the normalized quantity
  • getQuantity
    getter for quantity - gets The raw quantity
  • getSubType
  • getUnit
    getter for unit - gets The unit of the raw quantity
  • getValue
  • getUnit,
  • getValue,
  • readObject,
  • setConfidence,
  • setNormalizedQuantity,
  • setNormalizedUnit,
  • setQuantity,
  • setSubType,
  • setUnit

Popular in Java

  • Reading from database using SQL prepared statement
  • getApplicationContext (Context)
  • setScale (BigDecimal)
  • getExternalFilesDir (Context)
  • ObjectMapper (com.fasterxml.jackson.databind)
    ObjectMapper provides functionality for reading and writing JSON, either to and from basic POJOs (Pl
  • BigDecimal (java.math)
    An immutable arbitrary-precision signed decimal.A value is represented by an arbitrary-precision "un
  • SQLException (java.sql)
    An exception that indicates a failed JDBC operation. It provides the following information about pro
  • TimeUnit (java.util.concurrent)
    A TimeUnit represents time durations at a given unit of granularity and provides utility methods to
  • Filter (javax.servlet)
    A filter is an object that performs filtering tasks on either the request to a resource (a servlet o
  • Table (org.hibernate.mapping)
    A relational table
  • Top plugins for WebStorm
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now