Uh oh! We couldn’t find any match.

Please try other search keywords.

Bixby Developer Center

Guides

Measurement (viv.measurement)

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 (e.g., meters, inches, feet, etc., for lengths) and implements conversion actions. This allows your capsule to easily work with different kinds of measures.

Note

Types are always in the viv.* namespace, and in the viv.measurement.* namespace unless another namespace is specified (e.g., viv.rating.*). All properties have a cardinality of min (Required), max (One) unless otherwise specified.

Models

Angle

PropertyTypeKind
unitAngleUnitstructure-enum
valueAngleValuedecimal


AngleUnit

PropertyTypeKind
nameAngleUnitNameenum
abbreviationAngleUnitAbbreviationenum


AngleUnit is a structured enum with the following possible values:

nameabbreviation
Degreedeg
Radianrad

Azimuth


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.

Area

PropertyTypeKind
unitAreaUnitstructure-enum
valueAreaValuedecimal


AreaUnit

PropertyTypeKind
nameAreaUnitNameenum
abbreviationAreaUnitAbbreviationenum


AreaUnit is a structured enum with the following possible values:

nameabbreviation
SquareMillimetermm²
SquareCentimetercm²
SquareMeter
SquareKilometerkm²
SquareInchin²
SquareFootft²
SquareYardyd²
SquareMilemi²
Hectareha
Acreac

Length

PropertyTypeKind
unitLengthUnitstructure-enum
valueLengthValuedecimal


LengthUnit

PropertyTypeKind
nameLengthUnitNameenum
abbreviationLengthUnitAbbreviationenum


LengthUnit is a structured enum with the following possible values:

nameabbreviation
Millimetermm
Centimetercm
Meterm
Kilometerkm
Inchin
Footft
Yardyd
Milemi
NauticalMilenmi
Acreac

Depth

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

Height both extends and has the role-of Length. It has the same properties (LengthUnit and LengthValue) and the same possible values for LengthUnit.

Pressure

PropertyTypeKind
unitPressureUnitstructure-enum
valuePressureValuedecimal


PressureUnit

PropertyTypeKind
namePressureUnitNameenum
abbreviationPressureUnitAbbreviationenum

PressureUnit is a structured enum with the following possible values:

nameabbreviation
PascalPa
Millibarmbar
Barbar
InchesOfHginHg
MillimeterOfMercurymmHg
PoundsPerSquareInchpsi
HectopascalhPa
Torrtorr

Speed

PropertyTypeKind
unitSpeedUnitstructure-enum
valueSpeedValuedecimal


SpeedUnit

PropertyTypeKind
nameSpeedUnitNameenum
abbreviationSpeedUnitAbbreviationenum

SpeedUnit is a structured enum with the following possible values:

nameabbreviation
KilometersPerHourkph
MilesPerHourmph
MetersPerSecondmps

Temperature

PropertyTypeKind
unitTemperatureUnitstructure-enum
valueTemperatureValuedecimal


TemperatureUnit

PropertyTypeKind
nameTemperatureUnitNameenum
abbreviationTemperatureUnitAbbreviationenum


TemperatureUnit is a structured enum with the following possible values:

nameabbreviation
CelsiusC
FahrenheitF
KelvinK

Temperature Comparisons

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.

  • TemperatureAtLeast
  • TemperatureAtMost
  • TemperatureGreaterThan
  • TemperatureLessThan

Volume

PropertyTypeKind
unitVolumeUnitstructure-enum
valueVolumeValuedecimal

VolumeUnit

PropertyTypeKind
nameVolumeUnitNameenum
abbreviationVolumeUnitAbbreviationenum

VolumeUnit is a structured enum with the following possible values:

nameabbreviation
CubicMillimetermm³
CubicCentimetercm³
CubicMeter
CubicKilometerkm³
CubicInchin³
CubicFootft³
CubicYardyd³
CubicMilemi³
FluidOunceflOz
Teaspoontsp
Tablespoontbsp
Cupcp
Pintpt
Quartqt
Gallongal
LiterL
DeciliterdL
Decaliterdal
CentilitercL
MillilitermL
MicroliterµL

Weight

PropertyTypeKind
unitWeightUnitstructure-enum
valueWeightValuedecimal

WeightUnit

PropertyTypeKind
nameWeightUnitNameenum
abbreviationWeightUnitAbbreviationenum

WeightUnit is a structured enum with the following possible values:

nameabbreviation
Milligrammg
Centigramcg
Gramg
Kilogramkg
Metric Tonmt
Ounceoz
Poundlb
Tont
Stonest
Hectogramhg
Quintalq

Dimensions

This structure concept stores measurements in a three-dimensional space.

PropertyTypeKind
heightHeightdecimal
depthDepthdecimal
widthWidthdecimal

CardinalDirection

This primitive concept is an enum, with the following symbols:

  • N
  • NNE
  • NE
  • ENE
  • E
  • ESE
  • SE
  • SSE
  • S
  • SSW
  • SW
  • WSW
  • W
  • WNW
  • NW
  • NNW

Percentage

This primitive concept is a decimal, with a min-value of 0 and a max-value of 100.

Conversions

The viv.measurement library includes conversion actions:

  • ConvertAngle
  • ConvertArea
  • ConvertLength
  • ConvertPressure
  • ConvertSpeed
  • ConvertTemperature
  • ConvertVolume
  • ConvertWeight

All of the conversion actions use a common input/output format.

InputType
amountAngle, Area, etc.
toUnitToAngleUnit, 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:

  • ToAngleUnit
  • ToAreaUnit
  • ToLengthUnit
  • ToPressureUnit
  • ToSpeedUnit
  • ToTemperatureUnit
  • ToVolumeUnit
  • ToWeightUnit

Each type simply takes the role-of the corresponding unit type. For example, ToLengthUnit has the following definition:

structure-enum (ToLengthUnit) {
role-of (LengthUnit)
}

Training

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]}