Skip to main content
Språkbanken Text is a department within Språkbanken.

paragraph-sparv-whitespace

Citation Information

Språkbanken Text (2021). paragraph-sparv-whitespace (updated: 2021-05-07). [Analysis]. Språkbanken Text.

Standard reference Information

Bird, Steven, Edward Loper and Ewan Klein (2009), Natural Language Processing with Python. O’Reilly Media Inc.

Segments text into paragraphs by whitespaces using the RegexpTokenizer from NLTK

The documentation for NLTK's RegexpTokenizer can be found here.

Example

This analysis is used with Sparv. Check out Sparv's quick start guide to get started!

To use this analysis, add the following line under export.annotations in the Sparv corpus configuration file:

- segment.paragraph  # Paragraph segments

In order to use this paragraph segmenter you need to add the following setting to your Sparv corpus configuration file:

segment:
  paragraph_segmenter: whitespace

For more info on how to use Sparv, check out the Sparv documentation.

Example output:

<paragraph>
  <sentence>
    <token>Det</token>
    <token>här</token>
    <token>är</token>
    <token>en</token>
    <token>korpus</token>
    <token>.</token>
  </sentence>
</paragraph>
<paragraph>
  <sentence>
    <token>Den</token>
    <token>har</token>
    <token>flera</token>
    <token>stycken</token>
    <token>.</token>
  </sentence>
</paragraph>

Type

  • Analysis

Task

paragraph segmentation

Unit

paragraph

Tool

NLTK

Created

2010-12-15

Updated

2021-05-07

Contact

Språkbanken Text
sb-info@svenska.gu.se