The viv.measurement capsule provides a set of models for different kinds of measurement types and units, including area, angles, linear lengths (including depth and height), pressure, speed, temperature, volume, and weight. The capsule enumerates units for different kinds of measures (such as meters, inches, feet, etc., for lengths) and implements conversion actions. This allows your capsule to easily work with different kinds of measures.
Types are always in the viv.* namespace, and in the viv.measurement.* namespace unless another namespace is specified (for example, viv.rating.*). All properties have a cardinality of min (Required), max (One) unless otherwise specified.
This reference lists out several of the models available in this library capsule. Some sections contain tables listing information about those concepts or actions.
| Property | Type | Kind |
|---|---|---|
| unit | AngleUnit | structure-enum |
| value | AngleValue | decimal |
AngleUnit
| Property | Type | Kind |
|---|---|---|
| name | AngleUnitName | enum |
| abbreviation | AngleUnitAbbreviation | enum |
AngleUnit is a structured enum with the following possible values:
| name | abbreviation |
|---|---|
| Degree | deg |
| Radian | rad |
Azimuth both extends and has the role-of Angle. It has the same properties (AngleUnit and AngleValue) and the same possible values for AngleUnit.
An azimuth is an angular measurement between a reference direction and a point of interest in a spherical coordinate system.
| Property | Type | Kind |
|---|---|---|
| unit | AreaUnit | structure-enum |
| value | AreaValue | decimal |
AreaUnit
| Property | Type | Kind |
|---|---|---|
| name | AreaUnitName | enum |
| abbreviation | AreaUnitAbbreviation | enum |
AreaUnit is a structured enum with the following possible values:
| name | abbreviation |
|---|---|
| SquareMillimeter | mm² |
| SquareCentimeter | cm² |
| SquareMeter | m² |
| SquareKilometer | km² |
| SquareInch | in² |
| SquareFoot | ft² |
| SquareYard | yd² |
| SquareMile | mi² |
| Hectare | ha |
| Acre | ac |
| Property | Type | Kind |
|---|---|---|
| unit | LengthUnit | structure-enum |
| value | LengthValue | decimal |
LengthUnit
| Property | Type | Kind |
|---|---|---|
| name | LengthUnitName | enum |
| abbreviation | LengthUnitAbbreviation | enum |
LengthUnit is a structured enum with the following possible values:
| name | abbreviation |
|---|---|
| Millimeter | mm |
| Centimeter | cm |
| Meter | m |
| Kilometer | km |
| Inch | in |
| Foot | ft |
| Yard | yd |
| Mile | mi |
| NauticalMile | nmi |
| Acre | ac |
Depth both extends and has the role-of Length. It has the same properties (LengthUnit and LengthValue) and the same possible values for LengthUnit.
Height both extends and has the role-of Length. It has the same properties (LengthUnit and LengthValue) and the same possible values for LengthUnit.
| Property | Type | Kind |
|---|---|---|
| unit | PressureUnit | structure-enum |
| value | PressureValue | decimal |
PressureUnit
| Property | Type | Kind |
|---|---|---|
| name | PressureUnitName | enum |
| abbreviation | PressureUnitAbbreviation | enum |
PressureUnit is a structured enum with the following possible values:
| name | abbreviation |
|---|---|
| Pascal | Pa |
| Millibar | mbar |
| Bar | bar |
| InchesOfHg | inHg |
| MillimeterOfMercury | mmHg |
| PoundsPerSquareInch | psi |
| Hectopascal | hPa |
| Torr | torr |
| Property | Type | Kind |
|---|---|---|
| unit | SpeedUnit | structure-enum |
| value | SpeedValue | decimal |
SpeedUnit
| Property | Type | Kind |
|---|---|---|
| name | SpeedUnitName | enum |
| abbreviation | SpeedUnitAbbreviation | enum |
SpeedUnit is a structured enum with the following possible values:
| name | abbreviation |
|---|---|
| KilometersPerHour | kph |
| MilesPerHour | mph |
| MetersPerSecond | mps |
| Property | Type | Kind |
|---|---|---|
| unit | TemperatureUnit | structure-enum |
| value | TemperatureValue | decimal |
TemperatureUnit
| Property | Type | Kind |
|---|---|---|
| name | TemperatureUnitName | enum |
| abbreviation | TemperatureUnitAbbreviation | enum |
TemperatureUnit is a structured enum with the following possible values:
| name | abbreviation |
|---|---|
| Celsius | C |
| Fahrenheit | F |
| Kelvin | K |
The viv.measurement capsule includes the following temperature concepts for use in comparisons (for instance, judging weather conditions). Each of these concepts has the role-of Temperature.
TemperatureAtLeastTemperatureAtMostTemperatureGreaterThanTemperatureLessThan| Property | Type | Kind |
|---|---|---|
| unit | VolumeUnit | structure-enum |
| value | VolumeValue | decimal |
VolumeUnit
| Property | Type | Kind |
|---|---|---|
| name | VolumeUnitName | enum |
| abbreviation | VolumeUnitAbbreviation | enum |
VolumeUnit is a structured enum with the following possible values:
| name | abbreviation |
|---|---|
| CubicMillimeter | mm³ |
| CubicCentimeter | cm³ |
| CubicMeter | m³ |
| CubicKilometer | km³ |
| CubicInch | in³ |
| CubicFoot | ft³ |
| CubicYard | yd³ |
| CubicMile | mi³ |
| FluidOunce | flOz |
| Teaspoon | tsp |
| Tablespoon | tbsp |
| Cup | cp |
| Pint | pt |
| Quart | qt |
| Gallon | gal |
| Liter | L |
| Deciliter | dL |
| Decaliter | dal |
| Centiliter | cL |
| Milliliter | mL |
| Microliter | µL |
| Property | Type | Kind |
|---|---|---|
| unit | WeightUnit | structure-enum |
| value | WeightValue | decimal |
WeightUnit
| Property | Type | Kind |
|---|---|---|
| name | WeightUnitName | enum |
| abbreviation | WeightUnitAbbreviation | enum |
WeightUnit is a structured enum with the following possible values:
| name | abbreviation |
|---|---|
| Milligram | mg |
| Centigram | cg |
| Gram | g |
| Kilogram | kg |
| Metric Ton | mt |
| Ounce | oz |
| Pound | lb |
| Ton | t |
| Stone | st |
| Hectogram | hg |
| Quintal | q |
This structure concept stores measurements in a three-dimensional space.
| Property | Type | Kind |
|---|---|---|
| height | Height | decimal |
| depth | Depth | decimal |
| width | Width | decimal |
This primitive concept is an enum, with the following symbols:
This primitive concept is a decimal, with a min-value of 0 and a max-value of 100.
The viv.measurement library includes conversion actions:
ConvertAngleConvertAreaConvertLengthConvertPressureConvertSpeedConvertTemperatureConvertVolumeConvertWeightAll of the conversion actions use a common input/output format.
| Input | Type |
|---|---|
| amount | Angle, Area, etc. |
| toUnit | ToAngleUnit, ToAreaUnit, etc. |
The amount is the structure concept (with value and unit properties) being converted from; the toUnit is the appropriate structure enum concept for the unit being converted to. The following toUnit types are included:
ToAngleUnitToAreaUnitToLengthUnitToPressureUnitToSpeedUnitToTemperatureUnitToVolumeUnitToWeightUnitEach type simply takes the role-of the corresponding unit type. For example, ToLengthUnit has the following definition:
structure-enum (ToLengthUnit) {
role-of (LengthUnit)
}When utterances include measurements, you should train on the primitive units and values. The training on the utterance "convert 31.7 degrees Celsius to Fahrenheit" would be represented by this Aligned NL:
[g:viv.measurement.ConvertTemperature] convert (31.7)[v:viv.measurement.TemperatureValue] degrees (Celsius)[v:viv.measurement.TemperatureUnitName:Celsius] to {[g:viv.measurement.ToTemperatureUnit] (Fahrenheit)[v:viv.measurement.TemperatureUnitName:Fahrenheit]}