Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
Accessibilly opened this issue Mar 1, 2024 · 0 comments

Comments

@Accessibilly
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant