From da11580c059c203036ecf3327c0ffe29f08b2428 Mon Sep 17 00:00:00 2001 From: Azure SDK for Python bot Date: Sun, 4 Aug 2019 18:41:39 -0700 Subject: [PATCH] [AutoPR cognitiveservices/data-plane/InkRecognizer] [Hub Generated] Review request for InkRecognizer to add version preview/v1.0 (#5372) * Generated from 34c67e4beeb3721701921ded0f374c834723b2f7 re-naming inputDevice to inputDeviceKind * Generated from ae13f3bcaab268fc0365a1e0452535827d2bda64 Update specification/cognitiveservices/data-plane/InkRecognizer/preview/v1.0/InkRecognizer.json Co-Authored-By: Nick Schonning --- .../cognitiveservices/inkrecognizer/models.go | 35 ++-- .../v1.0/inkrecognizer/models.go | 153 ++++++++++++------ 2 files changed, 130 insertions(+), 58 deletions(-) diff --git a/profiles/preview/preview/cognitiveservices/inkrecognizer/models.go b/profiles/preview/preview/cognitiveservices/inkrecognizer/models.go index a9dfcd2a29fc..eced44eb7b8c 100644 --- a/profiles/preview/preview/cognitiveservices/inkrecognizer/models.go +++ b/profiles/preview/preview/cognitiveservices/inkrecognizer/models.go @@ -36,8 +36,8 @@ const ( InkDrawing Category = original.InkDrawing InkWord Category = original.InkWord Line Category = original.Line - ListItem Category = original.ListItem Paragraph Category = original.Paragraph + Root Category = original.Root Unknown Category = original.Unknown WritingRegion Category = original.WritingRegion ) @@ -53,11 +53,26 @@ type Container = original.Container const ( ContainerLine Container = original.ContainerLine - ContainerListItem Container = original.ContainerListItem ContainerParagraph Container = original.ContainerParagraph + ContainerRoot Container = original.ContainerRoot ContainerWritingRegion Container = original.ContainerWritingRegion ) +type InputDevice = original.InputDevice + +const ( + Armature InputDevice = original.Armature + ArticulatedArm InputDevice = original.ArticulatedArm + Digitizer InputDevice = original.Digitizer + LightPen InputDevice = original.LightPen + Pen InputDevice = original.Pen + StereoPlotter InputDevice = original.StereoPlotter + ThreedDigitizer InputDevice = original.ThreedDigitizer + TouchPad InputDevice = original.TouchPad + TouchScreen InputDevice = original.TouchScreen + WhiteBoard InputDevice = original.WhiteBoard +) + type Kind = original.Kind const ( @@ -125,14 +140,6 @@ const ( Mm Unit = original.Mm ) -type Unit1 = original.Unit1 - -const ( - Unit1Cm Unit1 = original.Unit1Cm - Unit1In Unit1 = original.Unit1In - Unit1Mm Unit1 = original.Unit1Mm -) - type AlternatePatternItem = original.AlternatePatternItem type AnalysisRequest = original.AnalysisRequest type AnalysisResponse = original.AnalysisResponse @@ -142,6 +149,8 @@ type DrawingAttributesPattern = original.DrawingAttributesPattern type DrawingAttributesPatternColor = original.DrawingAttributesPatternColor type ErrorModel = original.ErrorModel type ErrorModelDetailsItem = original.ErrorModelDetailsItem +type InkPoint = original.InkPoint +type InkPointValueAttribute = original.InkPointValueAttribute type PointDetailsPattern = original.PointDetailsPattern type RecognitionUnitItem = original.RecognitionUnitItem type RecognitionUnitItemBoundingRectangle = original.RecognitionUnitItemBoundingRectangle @@ -168,6 +177,9 @@ func PossibleClassValues() []Class { func PossibleContainerValues() []Container { return original.PossibleContainerValues() } +func PossibleInputDeviceValues() []InputDevice { + return original.PossibleInputDeviceValues() +} func PossibleKindValues() []Kind { return original.PossibleKindValues() } @@ -183,9 +195,6 @@ func PossibleShapeValues() []Shape { func PossibleTipValues() []Tip { return original.PossibleTipValues() } -func PossibleUnit1Values() []Unit1 { - return original.PossibleUnit1Values() -} func PossibleUnitValues() []Unit { return original.PossibleUnitValues() } diff --git a/services/preview/cognitiveservices/v1.0/inkrecognizer/models.go b/services/preview/cognitiveservices/v1.0/inkrecognizer/models.go index f200f311b249..c7aec42aab70 100644 --- a/services/preview/cognitiveservices/v1.0/inkrecognizer/models.go +++ b/services/preview/cognitiveservices/v1.0/inkrecognizer/models.go @@ -53,10 +53,10 @@ const ( InkWord Category = "inkWord" // Line ... Line Category = "line" - // ListItem ... - ListItem Category = "listItem" // Paragraph ... Paragraph Category = "paragraph" + // Root ... + Root Category = "root" // Unknown ... Unknown Category = "unknown" // WritingRegion ... @@ -65,7 +65,7 @@ const ( // PossibleCategoryValues returns an array of possible values for the Category const type. func PossibleCategoryValues() []Category { - return []Category{InkBullet, InkDrawing, InkWord, Line, ListItem, Paragraph, Unknown, WritingRegion} + return []Category{InkBullet, InkDrawing, InkWord, Line, Paragraph, Root, Unknown, WritingRegion} } // Class enumerates the values for class. @@ -89,17 +89,48 @@ type Container string const ( // ContainerLine ... ContainerLine Container = "line" - // ContainerListItem ... - ContainerListItem Container = "listItem" // ContainerParagraph ... ContainerParagraph Container = "paragraph" + // ContainerRoot ... + ContainerRoot Container = "root" // ContainerWritingRegion ... ContainerWritingRegion Container = "writingRegion" ) // PossibleContainerValues returns an array of possible values for the Container const type. func PossibleContainerValues() []Container { - return []Container{ContainerLine, ContainerListItem, ContainerParagraph, ContainerWritingRegion} + return []Container{ContainerLine, ContainerParagraph, ContainerRoot, ContainerWritingRegion} +} + +// InputDevice enumerates the values for input device. +type InputDevice string + +const ( + // Armature ... + Armature InputDevice = "armature" + // ArticulatedArm ... + ArticulatedArm InputDevice = "articulatedArm" + // Digitizer ... + Digitizer InputDevice = "digitizer" + // LightPen ... + LightPen InputDevice = "lightPen" + // Pen ... + Pen InputDevice = "pen" + // StereoPlotter ... + StereoPlotter InputDevice = "stereoPlotter" + // ThreedDigitizer ... + ThreedDigitizer InputDevice = "3dDigitizer" + // TouchPad ... + TouchPad InputDevice = "touchPad" + // TouchScreen ... + TouchScreen InputDevice = "touchScreen" + // WhiteBoard ... + WhiteBoard InputDevice = "whiteBoard" +) + +// PossibleInputDeviceValues returns an array of possible values for the InputDevice const type. +func PossibleInputDeviceValues() []InputDevice { + return []InputDevice{Armature, ArticulatedArm, Digitizer, LightPen, Pen, StereoPlotter, ThreedDigitizer, TouchPad, TouchScreen, WhiteBoard} } // Kind enumerates the values for kind. @@ -242,23 +273,6 @@ func PossibleUnitValues() []Unit { return []Unit{Cm, In, Mm} } -// Unit1 enumerates the values for unit 1. -type Unit1 string - -const ( - // Unit1Cm ... - Unit1Cm Unit1 = "cm" - // Unit1In ... - Unit1In Unit1 = "in" - // Unit1Mm ... - Unit1Mm Unit1 = "mm" -) - -// PossibleUnit1Values returns an array of possible values for the Unit1 const type. -func PossibleUnit1Values() []Unit1 { - return []Unit1{Unit1Cm, Unit1In, Unit1Mm} -} - // AlternatePatternItem ... type AlternatePatternItem struct { // Category - Possible values include: 'LeafInkDrawing', 'LeafInkBullet', 'LeafInkWord', 'LeafUnknown' @@ -277,12 +291,15 @@ type AlternatePatternItem struct { type AnalysisRequest struct { // ApplicationType - This describes the domain of the client application. Possible values include: 'Drawing', 'Writing', 'Mixed' ApplicationType Application `json:"applicationType,omitempty"` - // Unit - This represents the physical units of the ink strokes. It is up to the application developer to decide how to convert the device specific units to physical units before calling the service. The conversion factor can be different based on the type of the device used. Possible values include: 'Unit1Mm', 'Unit1Cm', 'Unit1In' - Unit Unit1 `json:"unit,omitempty"` + // InputDeviceKind - This identifies the kind of device used as the writing instrument. Possible values include: 'Digitizer', 'Pen', 'LightPen', 'TouchScreen', 'TouchPad', 'WhiteBoard', 'ThreedDigitizer', 'StereoPlotter', 'ArticulatedArm', 'Armature' + InputDeviceKind InputDevice `json:"inputDeviceKind,omitempty"` + // Unit - This is the physical unit of the ink strokes. It is up to the application developer to decide how to convert the device specific units to physical units before calling the service. The conversion factor can be different based on the type of the device used. Possible values include: 'Mm', 'Cm', 'In' + Unit Unit `json:"unit,omitempty"` // UnitMultiple - This is a scaling factor to be applied to the point coordinates when interpreting them in the physical units specified. UnitMultiple *float64 `json:"unitMultiple,omitempty"` // Language - The IETF BCP 47 language code (for ex. en-US, en-GB, hi-IN etc.) of the expected language for the handwritten content in the ink strokes. The response will include results from this language. - Language *string `json:"language,omitempty"` + Language *string `json:"language,omitempty"` + InkPointValueAttributes *[]InkPointValueAttribute `json:"inkPointValueAttributes,omitempty"` // Strokes - This is the array of strokes sent for recognition. Best results are produced when the order of strokes added in the array matches the order in which the user created them. Changing the stroke order may produce unexpected results. Strokes *[]Stroke `json:"strokes,omitempty"` } @@ -290,11 +307,11 @@ type AnalysisRequest struct { // AnalysisResponse this shows the expected contents of a response from the service type AnalysisResponse struct { autorest.Response `json:"-"` - // Unit - This represents the physical units of the ink strokes. It is up to the application developer to decide how to convert the device specific units to physical units before calling the service. The conversion factor can be different based on the type of the device used. Possible values include: 'Mm', 'Cm', 'In' + // Unit - This is the physical unit of the ink strokes. It is up to the application developer to decide how to convert the device specific units to physical units before calling the service. The conversion factor can be different based on the type of the device used. Possible values include: 'Mm', 'Cm', 'In' Unit Unit `json:"unit,omitempty"` // UnitMultiple - This is a scaling factor to be applied to the point coordinates when interpreting them in the physical units specified. UnitMultiple *float64 `json:"unitMultiple,omitempty"` - // Language - This is the language used for recognizing handwriting from the ink strokes in the request. Set this to the user’s preferred language. + // Language - This is the language used for recognizing handwriting from the ink strokes in the request. Language *string `json:"language,omitempty"` RecognitionUnits *[]RecognitionUnitItem `json:"recognitionUnits,omitempty"` } @@ -351,6 +368,53 @@ type ErrorModelDetailsItem struct { Target *string `json:"target,omitempty"` } +// InkPoint an object containing the properties of an point in the path of an ink stroke. The main +// properties are the x and y values. Other include tip pressure, x tilt etc. For the coordinate values, it +// is recommended to have a precision of 8 digits after the decimal to obtain most accurate recognition +// results. The origin (0,0) of the canvas is assumed to be at the top left corner of the canvas +type InkPoint struct { + // X - The x coordinate of the pen location on the writing surface. + X *float64 `json:"x,omitempty"` + // Y - The y coordinate of the pen location on the writing surface. + Y *float64 `json:"y,omitempty"` + // Z - The z coordinate of the pen location on the writing space. This may not be used for recognition. + Z *float64 `json:"z,omitempty"` + // TipPressure - The force exerted against the tablet surface by the transducer, typically a stylus. This may not be used for recognition. + TipPressure *float64 `json:"tipPressure,omitempty"` + // BarrelPressure - The force exerted directly by the user on a transducer sensor, such as a pressure-sensitive button on the barrel of a stylus. This may not be used for recognition. + BarrelPressure *float64 `json:"barrelPressure,omitempty"` + // Timestamp - The time relative to the absolute time the transducer last became active. This may not be used for recognition. + Timestamp *float64 `json:"timestamp,omitempty"` + // XTilt - The plane angle between the Y-Z plane and the plane containing the transducer axis and the Y axis. This may not be used for recognition. + XTilt *float64 `json:"xTilt,omitempty"` + // YTilt - The angle between the X-Z and transducer-X planes. A positive Y Tilt is toward the user. This may not be used for recognition. + YTilt *float64 `json:"yTilt,omitempty"` + // Width - The width of the tip of the writing instrument. This is used by touch screen devices to report the width of the finger contact on the writing surface. This may not be used for recognition. + Width *float64 `json:"width,omitempty"` + // Height - The height of the tip of the writing instrument. This is used by touch screen devices to report the height of the finger contact on the writing surface. This may not be used for recognition. + Height *float64 `json:"height,omitempty"` + // TipSwitch - A switch located on the tip of a stylus indicating contact of the stylus with a surface. This may not be used for recognition. + TipSwitch *bool `json:"tipSwitch,omitempty"` + // Inverted - A value that indicates that the currently sensed position originates from the end of a stylus opposite the tip switch. This may not be used for recognition. + Inverted *bool `json:"inverted,omitempty"` + // BarrelSwitch - A non-tip button located on the barrel of a stylus. Its function is typically mapped to a system secondary button. This may not be used for recognition. + BarrelSwitch *bool `json:"barrelSwitch,omitempty"` + // Eraser - The control is used for erasing objects. It is typically located opposite the writing end of a stylus. This may not be used for recognition. + Eraser *bool `json:"eraser,omitempty"` + // SecondaryTip - A secondary switch used in conjunction with the tip switch to indicate pressure above a certain threshold applied with the stylus. This may not be used for recognition. + SecondaryTip *bool `json:"secondaryTip,omitempty"` +} + +// InkPointValueAttribute a container for the attributes of a value contained in the ink point object. +type InkPointValueAttribute struct { + // Name - The name of the point attribute. + Name *string `json:"name,omitempty"` + // LogicalMinimum - The minimum value for the attribute + LogicalMinimum *float64 `json:"logicalMinimum,omitempty"` + // LogicalMaximum - The maximum value for the attribute + LogicalMaximum *float64 `json:"logicalMaximum,omitempty"` +} + // PointDetailsPattern this holds all the properties of one point type PointDetailsPattern struct { // X - This represents the x coordinate of the point @@ -359,11 +423,11 @@ type PointDetailsPattern struct { Y *float64 `json:"y,omitempty"` } -// RecognitionUnitItem this represents the recognized entity +// RecognitionUnitItem this identifies the recognized entity type RecognitionUnitItem struct { // ID - The identifier of the recognition unit. This id is used to indicate parent/child relationship between different recognition units. ID *int32 `json:"id,omitempty"` - // Category - Possible values include: 'WritingRegion', 'Paragraph', 'ListItem', 'Line', 'InkBullet', 'InkDrawing', 'InkWord', 'Unknown' + // Category - Possible values include: 'Root', 'WritingRegion', 'Paragraph', 'Line', 'InkBullet', 'InkDrawing', 'InkWord', 'Unknown' Category Category `json:"category,omitempty"` Alternates *[]AlternatePatternItem `json:"alternates,omitempty"` // Center - The coordinates (x,y) of the center of the recognition unit. @@ -376,34 +440,34 @@ type RecognitionUnitItem struct { Class Class `json:"class,omitempty"` // ParentID - The id of the parent node in the tree structure of the recognition results. parent = 0 indicates that there is no dedicated parent node for this unit. ParentID *int32 `json:"parentId,omitempty"` - // BoundingRectangle - The bounding rectangle of the recognized unit represented by the coordinates of the top left corner (x,y) along with width (w) and height (h) of the rectangle. Note that this rectangle is not rotated. So for rotated objects such as slanted handwriting, it will cover the entire object. The unit will be matched to the one specified in the original request (mm by default.) + // BoundingRectangle - The bounding rectangle of the recognition unit represented by the coordinates of the top left corner (topX,topY) along with width and height of the rectangle. Note that this rectangle is not rotated. So for rotated objects such as slanted handwriting, it will cover the entire object. The unit will be matched to the one specified in the original request (mm by default.) BoundingRectangle *RecognitionUnitItemBoundingRectangle `json:"boundingRectangle,omitempty"` - // RotatedBoundingRectangle - This property provides the rotated bounding rectangle that covers the entire recognized object along the angle of rotation of the object. Note that this is NOT the same as rotating the boundingRectangle by the rotation angle. + // RotatedBoundingRectangle - This is the rotated bounding rectangle that covers the entire recognized object along the angle of rotation of the object. Note that this is NOT the same as rotating the boundingRectangle by the rotation angle. RotatedBoundingRectangle *[]PointDetailsPattern `json:"rotatedBoundingRectangle,omitempty"` - // StrokeIds - This is an array of integers representing the list of stroke Identifier integers from the input request body that belong to this recognition unit. + // StrokeIds - This is an array of integers representing the list of stroke Identifiers from the input request body that belong to this recognition unit. StrokeIds *[]int32 `json:"strokeIds,omitempty"` - // RecognizedText - The string represents the text that was recognized. It can be an empty string if the recognizer cannot determine the text. + // RecognizedText - The string contains the text that was recognized. It can be an empty string if the recognizer cannot determine the text. RecognizedText *string `json:"recognizedText,omitempty"` - // Confidence - The class represents the type of the recognition unit. A recognition unit can be a leaf node or a container node. Container nodes typically have leaf nodes as children. + // Confidence - A number between 0 and 1 which indicates the confidence level in the result. Confidence *float64 `json:"confidence,omitempty"` - // RotationAngle - This represents the angle at which the unit is rotated in degrees with respect to the positive X axis. + // RotationAngle - This is the angle at which the unit is rotated in degrees with respect to the positive X axis. RotationAngle *float64 `json:"rotationAngle,omitempty"` // RecognizedObject - Possible values include: 'ShapeDrawing', 'ShapeSquare', 'ShapeRectangle', 'ShapeCircle', 'ShapeEllipse', 'ShapeTriangle', 'ShapeIsoscelesTriangle', 'ShapeEquilateralTriangle', 'ShapeRightTriangle', 'ShapeQuadrilateral', 'ShapeDiamond', 'ShapeTrapezoid', 'ShapeParallelogram', 'ShapePentagon', 'ShapeHexagon', 'ShapeBlockArrow', 'ShapeHeart', 'ShapeStarSimple', 'ShapeStarCrossed', 'ShapeCloud', 'ShapeLine', 'ShapeCurve', 'ShapePolyLine' RecognizedObject Shape `json:"recognizedObject,omitempty"` } -// RecognitionUnitItemBoundingRectangle the bounding rectangle of the recognized unit represented by the -// coordinates of the top left corner (x,y) along with width (w) and height (h) of the rectangle. Note that +// RecognitionUnitItemBoundingRectangle the bounding rectangle of the recognition unit represented by the +// coordinates of the top left corner (topX,topY) along with width and height of the rectangle. Note that // this rectangle is not rotated. So for rotated objects such as slanted handwriting, it will cover the // entire object. The unit will be matched to the one specified in the original request (mm by default.) type RecognitionUnitItemBoundingRectangle struct { - // TopX - This represents the top left x coordinate + // TopX - This is the top left x coordinate TopX *float64 `json:"topX,omitempty"` - // TopY - This represents the top left y coordinate + // TopY - This is the top left y coordinate TopY *float64 `json:"topY,omitempty"` - // Width - This represents width of the bounding rectangle + // Width - This is width of the bounding rectangle Width *float64 `json:"width,omitempty"` - // Height - The represents the height of the bounding rectangle + // Height - The is the height of the bounding rectangle Height *float64 `json:"height,omitempty"` } @@ -412,9 +476,8 @@ type Stroke struct { // ID - This is treated as a unique identifier for each stroke within a request. If the id is repeated within the same request, the service will return an error. ID *int32 `json:"id,omitempty"` // Language - The IETF BCP 47 language code (for ex. en-US, en-GB, hi-IN etc.) of the expected language for the handwritten content in this stroke. The response will include results from this language. - Language *string `json:"language,omitempty"` - // Points - A string of comma separated floating point values that represent the x and y coordinates of points that are part of the stroke. (X1,Y1, X2,Y2…). It is recommended to have a precision of 8 digits after the decimal to obtain most accurate recognition results. The origin (0,0) of the canvas is assumed to be at the top left corner of the canvas - Points *string `json:"points,omitempty"` + Language *string `json:"language,omitempty"` + Points *[]InkPoint `json:"points,omitempty"` DrawingAttributes *DrawingAttributesPattern `json:"drawingAttributes,omitempty"` // Kind - This is an optional property which influences the decision about what the stroke kind is between inkWriting and inkDrawing. This property should be set ONLY if the type of user content is known ahead of time. Not setting this value implies the kind is not known ahead of time. Kind represents the type of content the stroke is a part of. Possible values include: 'KindInkDrawing', 'KindInkWriting' Kind Kind `json:"kind,omitempty"`