Skip to content

content-lense/content-lense-text-complexity

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Welcome to Content Lense Text Complexity API 👋

This is a microservice APIof Content Lense, a project that aims at enabling publishers to easily gain insights into their content. This API calculates the complexity, reading time and more basic stats of the given article.

Please note that this repository is part of the Content Lense Project and depends on the Content Lense API.

Building the Docker image

Build the Docker image by running:

docker build -f Docker/Dockerfile -t content-lense-text-complexity:latest .

Running the service

Start the container with

docker run -it --rm -p 5001:5001 content-lense-text-complexity

Using the api

Analyse articles

To analyse an article send a post request to the /articles endpoint as Content-Type: application/json with the following stucture:

{
  "heading": "The Headline of the Article",
  "summary": "A short summary / abstract of the article",
  "body": "The entire fulltext"
}

The return type looks like the following:

{
    "body": {
        "descriptives": {
            "averageWordsPerSentence": 8.2,
            "meanCharsPerWord": 4.439024390243903,
            "meanWordsPerSentence": 6.833333333333333,
            "medianCharsPerWord": 4,
            "medianWordsPerSentence": 5,
            "totalChars": 190,
            "totalLetters": 182,
            "totalSentences": 5,
            "totalSyllables": 52,
            "totalUniqueWords": 37,
            "totalWords": 41,
            "totalWordsLongerThanThreeSyllables": 3,
            "totalSingleSyllableWords": 33
        },
        "scores": {
            "readingTimeInMinutes": 2.79,
            "wienerSachtextIndex": 1.2 // see https://de.wikipedia.org/wiki/Lesbarkeitsindex
        }
    },
    "heading": {/*... same result keys as for body ... */},
    "summary": {/*... same result keys as for body ... */}
}

We assume a reading speed of 200 words per minute to calculate the estimated reading time.

Sources

Supported by

Media Tech Lab media-tech-lab


Cloud Creators GmbH cloud-creators

About

Get the complexity of texts via an HTTP api

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published