segment property
result.match_info.rules.segment
is an array containing the results of segmentation.
Each item of the array corresponds to a segment and has the following properties:
Property | Description |
---|---|
name |
Segment name |
instances |
Segment instances |
instances
is an array. Each of its item corresponds to an instance of the segment and has the following properties:
Property | Description |
---|---|
begin |
Starting position of the segment instance in the text |
end |
Ending position of the segment instance in the text |
score |
Instance score |
rules |
Segmentation rules that have been triggered |
rules
is an array. Each of its items corresponds to a segmentation rule that has been triggered and has the following properties:
Property | Description |
---|---|
id |
Internal ID of the rule |
label |
Rule label |
scope |
Rule scope |
scope
is an array. Each of its items corresponds to a scope in which the segmentation rule was triggered and has the following properties:
Property | Description |
---|---|
begin |
Starting position of the scope in the text |
end |
Ending position of the scope in the text |
operands |
Segmentation rule operands |
operands
is an array. Each of its items correspond to a matched operand of the condition of the segmentation rule and has the following properties:
Property | Description |
---|---|
operand |
Internal ID of the rule operand |
begin |
Starting position of the text that was matched by the operand |
end |
Ending position of the text that was matched by the operand |
For example, considering this definition of segments:
SEGMENTS
{
@JOB_AND_COMPANY_JOHN_DOE,
@JOB_AND_COMPANY_JANE_DOE
}
and these segmentation rules:
SCOPE SENTENCE
{
SEGMENT(JOB_AND_COMPANY_JOHN_DOE)
{
LEMMA("developer")
<1:4>
TYPE(COM)
}
SEGMENT(JOB_AND_COMPANY_JANE_DOE)
{
LEMMA("technical writer")
<1:4>
TYPE(COM)
}
}
When applied to this text:
John Doe was born on the 15th of June 1995, he lives in 17 Johns Street and he works as a developer for expert.ai.
Jane Doe was born on the 16th of June 1995, she lives in 18 Miller Street and she works as a technical writer for expert.ai.
the segment
property has the following JSON serialization:
"segment": [
{
"name": "JOB_AND_COMPANY_JANE_DOE",
"instances": [
{
"begin": 115,
"end": 237,
"score": 10,
"rules": [
{
"id": 5,
"label": "",
"scope": [
{
"begin": 115,
"end": 237,
"operands": [
[
{
"operand": 5,
"begin": 207,
"end": 222
},
{
"operand": 5,
"begin": 228,
"end": 236
}
]
]
}
]
}
]
}
]
},
{
"name": "JOB_AND_COMPANY_JOHN_DOE",
"instances": [
{
"begin": 0,
"end": 113,
"score": 10,
"rules": [
{
"id": 4,
"label": "",
"scope": [
{
"begin": 0,
"end": 113,
"operands": [
[
{
"operand": 4,
"begin": 90,
"end": 98
},
{
"operand": 4,
"begin": 104,
"end": 112
}
]
]
}
]
}
]
}
]
}
]