Skip to content
This repository has been archived by the owner on Apr 26, 2024. It is now read-only.

Change the way we summarize URLs #973

Merged
merged 8 commits into from
Aug 4, 2016
Merged

Change the way we summarize URLs #973

merged 8 commits into from
Aug 4, 2016

Conversation

erikjohnston
Copy link
Member

Using XPath is slow on some machines (for unknown reasons), so use a different approach to get a list of text nodes.

Try to generate a summary that respect paragraph and then word boundaries, adding ellipses when appropriate.

Using XPath is slow on some machines (for unknown reasons), so use a
different approach to get a list of text nodes.

Try to generate a summary that respect paragraph and then word
boundaries, adding ellipses when appropriate.
new_desc = ""

# This splits the paragraph into words, but keeping the
# (proceeding) whitespace intact so we can easily concat
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

preceeding?

new_desc = new_desc[:MAX_SIZE]

# We always add an ellipsis because at the very least
# we chooped mid paragraph.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

chopped

@ara4n
Copy link
Member

ara4n commented Aug 2, 2016

lgtm modulo a test :)

@erikjohnston erikjohnston merged commit a5d7968 into develop Aug 4, 2016
@richvdh richvdh deleted the erikj/xpath_fix branch December 1, 2016 14:09
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants