Coder Social home page Coder Social logo

swifttextrank's Introduction

SwiftTextRank

Swift implementation of TextRank algorithm

swifttextrank's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

swifttextrank's Issues

code lacks documentation, but this sample code may reflect developer's intent

I didn't find a comment or document with sample code illustrating how to run the project. However, of the three TextRank projects written in Swift on Github I've tried, this was the first I got running. To experiment with extractive text summarization this project could be a good starting point.

Summary.build() returns a [String] array. Those testing the project might consider modifying Summary.build(), which calls TextRank.build(), so that it returns an array of structs, with each struct containing the String and the floating point value for the score.

The code ran for me when I tried this:

//sample: Litany Against Fear from Dune by Frank Herbert
let text =
"""
I must not fear.
Fear is the mind-killer.
Fear is the little-death that brings total obliteration.
I will face my fear.
I will permit it to pass over me and through me.
And when it has gone past, I will turn the inner eye to see its path.
Where the fear has gone there will be nothing. Only I will remain.
"""

let summary = Summary(text)

let build = summary.build()

for item in build
{
    print(item)
}

Output:

Where the fear has gone there will be nothing.
Fear is the mind-killer.

Only I will remain.
I will permit it to pass over me and through me.

Fear is the little-death that brings total obliteration.

I will face my fear.

And when it has gone past, I will turn the inner eye to see its path.

I must not fear.

For a longer text try the input from a page such as this:
https://medium.com/analytics-vidhya/text-summarization-in-python-using-extractive-method-including-end-to-end-implementation-2688b3fd1c8c

However, processing longer texts might take minutes to run in an Xcode Playground.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.