Skip to content

Highlights Supported by Deciding Force Parser #163

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

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

stevenelleman
Copy link
Contributor

@stevenelleman stevenelleman commented Oct 12, 2017

What
Previously the Deciding Force parser was unable to handle highlights/square brackets. With these additions the parser now removes highlights from the text, records the highlight offsets in the article metadata, and throws errors if improperly formatted highlights or square brackets are found in the text.

How
I iterated through the text file to find "[" and "]" characters, signifying the start and end of a highlight. If a left bracket was found without its corresponding right bracket or vice versa an error is thrown. When a highlight has been closed by a left and right square bracket the highlight is stored and removed from the text. In a final step the highlight text is compared to the article to find its starting index offset. At this stage all the highlight offsets are calculated.

Why
Handle highlights in Deciding Force articles.

Comments

  • I added a new class of exceptions in pybossa_api.py but when I tried to import it to parse_document.py an error was raised about pybossa_api.py needing django to be imported. I want to clarify at this stage whether I should add the dependencies for pybossa_api.py or stick with vanilla exceptions.
  • Also I'm aware that this branch is behind master by quite a bit but looking at the diff it doesn't look like it matters.
  • Can I delete the previous code that was commented out?

@stevenelleman stevenelleman changed the title Stevenelleman square brackets parser Highlights Supported by Deciding Force Parser Oct 12, 2017
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

Successfully merging this pull request may close these issues.

2 participants