Skip to main content

CutQuestions - Extract questions from an exam paper

Extracts questions and structured question information. Given an exam paper or a full-page question image, the algorithm returns the position and structured information for each question, including its stem, options, and answers.

Usage notes

Activate EduTutor. During the public preview, each account can call this operation 1,000 times per day free of charge.

Try it out

You can call this operation in OpenAPI Explorer without calculating a signature. After a successful call, OpenAPI Explorer can automatically generate SDK code examples. Try it out

Authorization information

The following table describes the authorization information for this API operation. You can use this information in the Action element of a RAM policy statement to grant a RAM user or RAM role permission to call the operation. The columns are described as follows:
  • Action: a specific permission.
  • Access level: the access level of an action. Valid values: Write, Read, and List.
  • Resource type: the types of resources for which the action supports authorization:
    • Required resource types are marked with an asterisk (*).
    • Actions that do not support resource-level authorization use All resources.
  • Condition key: a condition key defined by the cloud service.
  • Dependent action: an additional permission required to perform the action. The caller must also have permission to perform the dependent action.
ActionAccess levelResource typeCondition keyDependent action
edututor:CutQuestionsnone
*All resources
*
    None
None

Request syntax

POST /service/cutApi HTTP/1.1

Request parameters

NameTypeRequiredDescriptionExample
workspaceIdstringYes

The Alibaba Cloud Model Studio workspace ID for this request.

llm-1ijrzuv3v0ivvls7
bodyobjectNo

The request body.

imagestringYes

The URL of the exam paper or question image.

https://oss.xxx.com/xx.png
parametersobjectYes

The parameter configuration.

structbooleanYes

Specifies whether to return structured information.

true
extract_imagesbooleanYes

Specifies whether to return temporary OSS URLs for subquestion images so that they can be used directly for subsequent question answering.

true

Response parameters

NameTypeDescriptionExample
object

Schema of Response

requestIdstring

The unique request ID, used for troubleshooting.

1CE2851D-96D6-51D0-8ADA-EB7ACAF374BB
successboolean

Indicates whether the call succeeded.

True
codestring

The response status code.

SUCCESS
httpStatusCodeinteger

The HTTP status code.

200
messagestring

The description of the response code.

success
datastring

The algorithm results.

'{ "questions": [ { "pos_list": [ [ 21, 0, 364, 0, 364, 82, 21, 82 ] ], "sub_images": [ "http://duguang-mld.oss-accelerate.aliyuncs.com/ocr_edu/1CE2851D-96D6-51D0-8ADA-EB7ACAF374BB_0_0.png?OSSAccessKeyId=YOUR_ACCESS_KEY_ID****&Expires=1755593474&Signature=YOUR_SIGNATURE" ], "merged_image": "http://duguang-mld.oss-accelerate.aliyuncs.com/ocr_edu/1CE2851D-96D6-51D0-8ADA-EB7ACAF374BB_0_0.png?OSSAccessKeyId=YOUR_ACCESS_KEY_ID****&Expires=1755593474&Signature=YOUR_SIGNATURE", "info": { "stem": { "text": "8. 若 \\\\(a + b = -1\\\\), \\\\(ab = 4\\\\), 则 \\\\((4a - 5b - 3ab) - (3a - 6b + ab)\\\\) 的值为 _ 。", "pos_list": [ [ 21, 4, 364, 4, 364, 78, 21, 78 ] ] }, "option": [], "figure": [], "answer": [ { "text": "-17", "pos_list": [ [ 225, 51, 262, 51, 262, 70, 225, 70 ] ] } ], "type": "填空题", "subquestion": [] } } ] }'
input_tokensinteger

The number of input tokens consumed by this call.

80
output_tokensinteger

The number of output tokens consumed by this call.

38

Algorithm result field: data

  • Serialization is required. The fields are described as follows:
FieldTypeDescriptionExample
questionsarrayThe questions extracted by the model.
questions[i].pos_listarrayThe bounding boxes of the ith question. A question may have multiple bounding boxes.[[21,0,364,0,364,82,21,82]]
questions[i].sub_imagesarrayThe URLs of subimages extracted from the bounding boxes. Valid for 7 days.
questions[i].merged_imagestringThe URL of the complete question image formed by merging all subimages. Valid for 7 days.
questions[i].infoobjectThe structured question information.
questions[i].info.typestringThe question type: multiple choice, fill in the blank, true or false, short answer, essay, or other.Fill in the blank
questions[i].info.stemarrayThe question stem information.
questions[i].info.stem.textstringThe question stem text.
questions[i].info.stem.pos_listarrayThe bounding boxes of the question stem.
questions[i].info.optionarrayThe answer option information.
questions[i].info.option[j].textstringThe answer option text.
questions[i].info.option[j].pos_listarrayThe answer option positions.
questions[i].info.figurearrayThe illustration information.
questions[i].info.figure[k].pos_listarrayThe illustration positions.
questions[i].info.answerarrayThe answer information.
questions[i].info.answer[m].pos_listarrayThe answer positions."-17"
questions[i].info.answer[m].textstringThe answer text.
questions[i].info.subquestionarrayThe subquestion information. Uses the same structure as info.
Example:
{
    "questions": [
        {
            "pos_list": [
                [
                    21,
                    0,
                    364,
                    0,
                    364,
                    82,
                    21,
                    82
                ]
            ],
            "sub_images": [
                "http://xxxxx/sub_images/1CE2851D-96D6-51D0-8ADA-EB7ACAF374BB_0_0.png"
            ],
            "merged_image": "http://xxxxx/sub_images/1CE2851D-96D6-51D0-8ADA-EB7ACAF374BB.png",
            "info": {
                "stem": {
                    "text": "8. 若 \\\\(a + b = -1\\\\), \\\\(ab = 4\\\\), 则 \\\\((4a - 5b - 3ab) - (3a - 6b + ab)\\\\) 的值为 _ 。",
                    "pos_list": [
                        [
                            21,
                            4,
                            364,
                            4,
                            364,
                            78,
                            21,
                            78
                        ]
                    ]
                },
                "option": [],
                "figure": [],
                "answer": [
                    {
                        "text": "-17",
                        "pos_list": [
                            [
                                225,
                                51,
                                262,
                                51,
                                262,
                                70,
                                225,
                                70
                            ]
                        ]
                    }
                ],
                "type": "填空题",
                "subquestion": []
            }
        }
    ]
}

Examples

Sample success response JSON format
{
  "requestId": "1CE2851D-96D6-51D0-8ADA-EB7ACAF374BB",
  "success": true,
  "code": "SUCCESS",
  "httpStatusCode": 200,
  "message": "success",
  "data": "'{\n    \"questions\": [\n        {\n            \"pos_list\": [\n                [\n                    21,\n                    0,\n                    364,\n                    0,\n                    364,\n                    82,\n                    21,\n                    82\n                ]\n            ],\n            \"sub_images\": [\n                \"http://duguang-mld.oss-accelerate.aliyuncs.com/ocr_edu/1CE2851D-96D6-51D0-8ADA-EB7ACAF374BB_0_0.png?OSSAccessKeyId=YOUR_ACCESS_KEY_ID&Expires=1755593474&Signature=YOUR_SIGNATURE"\n            ],\n            \"merged_image\": \"http://duguang-mld.oss-accelerate.aliyuncs.com/ocr_edu/1CE2851D-96D6-51D0-8ADA-EB7ACAF374BB_0_0.png?OSSAccessKeyId=YOUR_ACCESS_KEY_ID&Expires=1755593474&Signature=YOUR_SIGNATURE",\n            \"info\": {\n                \"stem\": {\n                    \"text\": \"8. 若 \\\\\\\\(a + b = -1\\\\\\\\), \\\\\\\\(ab = 4\\\\\\\\), 则 \\\\\\\\((4a - 5b - 3ab) - (3a - 6b + ab)\\\\\\\\) 的值为 _ 。\",\n                    \"pos_list\": [\n                        [\n                            21,\n                            4,\n                            364,\n                            4,\n                            364,\n                            78,\n                            21,\n                            78\n                        ]\n                    ]\n                },\n                \"option\": [],\n                \"figure\": [],\n                \"answer\": [\n                    {\n                        \"text\": \"-17\",\n                        \"pos_list\": [\n                            [\n                                225,\n                                51,\n                                262,\n                                51,\n                                262,\n                                70,\n                                225,\n                                70\n                            ]\n                        ]\n                    }\n                ],\n                \"type\": \"填空题\",\n                \"subquestion\": []\n            }\n        }\n    ]\n}'",
  "input_tokens": 80,
  "output_tokens": 38
}

Error codes

For more error codes, see Error Center.

Change history

Change dateChange summaryAction
No change history is available.