Skip to content

Add IOS smart quotes to parser.py - Note this is entirely untested so will need to be tested by someone who *can*#226

Open
JasonCubed132 wants to merge 1 commit intoUWCS:masterfrom
JasonCubed132:master
Open

Add IOS smart quotes to parser.py - Note this is entirely untested so will need to be tested by someone who *can*#226
JasonCubed132 wants to merge 1 commit intoUWCS:masterfrom
JasonCubed132:master

Conversation

@JasonCubed132
Copy link
Copy Markdown

No description provided.

Comment on lines 58 to +60
word_topic = reg(r'[^"\s]+?(?=[+-]{2})')
string_topic = reg(r'".*?(?<!\\)(\\\\)*?"(?=[+-]{2})')
string_topic = quotes & reg(r".*?(?<!\\)(\\\\)*?") & quotes & reg(r"(?=[+-]{2})")

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

word_topic = reg(r'[^"“”\s]+?(?=[+-]{2})')
string_topic = reg(r'["“].*?(?<!\\)(\\\\)*?["”](?=[+-]{2})')

lambda s: s[1:-1]
)
reason_words = reg(r"(?i)because") | reg(r"(?i)for")
text_reason = reason_words >> (reg(r'[^",]+') | quote_reason)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

text_reason = reason_words >> (reg(r'[^"“”,]+') | quote_reason)


bracket_reason = reg(r"\(.+?\)") > (lambda s: s[1:-1])
quote_reason = reg(r'".*?(?<!\\)(\\\\)*?"(?![+-]{2})') > (lambda s: s[1:-1])
quote_reason = reg(r"\".*?(?<!\\)(\\\\)*?\"(?![+-]{2})") > (
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

quote_reason = reg(r'["“].*?(?<!\\)(\\\\)*?["”](?![+-]{2})') > (

class KarmaParser(TextParsers):
anything = reg(r".") > constant(None)

quotes = reg(r'["“”]')
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Remove, not sure why mixing this in doesn't work, but hardcoding them in does

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