Split by Sentence

Splits input content into sentences.

SENTENCES Old McDonald had a farm. SENTENCES And in the farm he had a cow.

📘

Use Split by Sentence Skill to:

👍

Benchmarks

Coming soon...

Output labels

Type

Value

sentence

The sentence text

Parameters

This skill takes no parameters as input.

Example

Request

curl -X POST \
'https://api.oneai.com/api/v0/pipeline' \
-H 'accept: application/json' \
-H 'Content-Type: application/json' \
-H 'api-key: <YOUR-API-KEY-HERE>' \
-d '{
    "input": "Old McDonald had a farm. And in the farm he had a cow.",
    "steps": [
      {
        "skill": "sentences"
      }   
    ]
}'
const OneAI = require("oneai");

const oneai = new OneAI("<YOUR-API-KEY-HERE>");
const text = "Old McDonald had a farm. And in the farm he had a cow.";
const pipeline = new oneai.Pipeline(
    oneai.skills.splitBySentence(),
);

pipeline.run(text).then(console.log);
import oneai

oneai.api_key = "<YOUR-API-KEY-HERE>"
text = "Old McDonald had a farm. And in the farm he had a cow."
pipeline = oneai.Pipeline(
  steps = [
        oneai.skills.SplitBySentence(),
  ]
)

output = pipeline.run(text)

Response

{
  "input_text": "Old McDonald had a farm. And in the farm he had a cow.",
  "status": "success",
  "output": [
    {
      "text_generated_by_step_name": "input",
      "text_generated_by_step_id": 0,
      "text": "Old McDonald had a farm. And in the farm he had a cow.",
      "labels": [
        {
          "type": "sentence",
          "skill": "sentences",
          "value": "Old McDonald had a farm.",
          "span_text": "Old McDonald had a farm.",
          "span": [
            0,
            24
          ],
          "output_spans": [
            {
              "section": 0,
              "start": 0,
              "end": 24
            }
          ]
        },
        {
          "type": "sentence",
          "skill": "sentences",
          "value": "And in the farm he had a cow.",
          "span_text": "And in the farm he had a cow.",
          "span": [
            25,
            54
          ],
          "output_spans": [
            {
              "section": 0,
              "start": 25,
              "end": 54
            }
          ]
        }
      ]
    }
  ],
  "stats": {
    "concurrency_wait_time": 0,
    "total_running_jobs": 1,
    "total_waiting_jobs": 0
  }
}
{
  text: 'Old McDonald had a farm. And in the farm he had a cow.',
  sentences: [
    {
      type: 'sentence',
      skill: 'sentences',
      value: 'Old McDonald had a farm.',
      span_text: 'Old McDonald had a farm.',
      span: [ 0, 24 ],
      output_spans: [ { section: 0, start: 0, end: 24 } ]
    },
    {
      type: 'sentence',
      skill: 'sentences',
      value: 'And in the farm he had a cow.',
      span_text: 'And in the farm he had a cow.',
      span: [ 25, 54 ],
      output_spans: [ { section: 0, start: 25, end: 54 } ]
    }
  ]
}

Did this page help you?