Swift implementation of TextRank algorithm
goncharik / swifttextrank Goto Github PK
View Code? Open in Web Editor NEWSwift implementation of TextRank algorithm
Swift implementation of TextRank algorithm
Swift implementation of TextRank algorithm
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.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.