Grep Results Schema for JSON#

Application ID eot_grep

Description#

The GrepResults schema describes the structure of the JSON data returned from the Grep application by the SDK or the Portal.

Definition#

The GrepResults schema holds the search results and is defined as:

  • object – The search results

    <matches> (array[Match]) – The information for the matching instance <summary> (Summary) – The aggregated information for the matches

with the Match schema defined as:

  • object – The match information

    • text (string ) – The literal that matches the expression

    • groups (array[Match]) – The capture groups if any. Capture groups are create when using { … }=MyName in the expression

    • sentence_index (number) – The sentence in which the match occurred

with the Summary schema defined as:

  • array[Group] – The match information

with the Group schema defined as:

  • name (string) – The name of the capture group. Default is 'match'

  • data (array[FrequencyData]) – The frequency of the matched groups

with the FrequencyData schema defined as:

  • count (number) – The number of matches

  • groups (array[string]) – The different matches of that group

Note

If using a capture group ({ … }=MyName) in the expression then an extra group name collocation will be added with the result of the collocations. For example: "{Person} = person .. { Company } = company }"

Example#

The following is an example of the JSON results for this application:

eot_grep#
{
    "matches": [
        {
            "text": "John Smith",
            "groups": [],
            "sentence_index": 0
        },
        {
            "text": "John Smith",
            "groups": [],
            "sentence_index": 1
        },
        {
            "text": "John Smith",
            "groups": [],
            "sentence_index": 1
        },
        {
            "text": "Jane Goodmam",
            "groups": [],
            "sentence_index": 1
        }
    ],
    "summary": [
        {
            "name": "match",
            "data": [
                {
                    "count": 1,
                    "groups": [ "Jane Goodmam" ]
                },
                {
                    "count": 3,
                    "groups": [ "John Smith" ]
                }
            ]
        }
    ]
}