Comments (4)
I see this is using myna for parsing. I'm not too familiar, but I did begin work on this.
Right now here's my status:
I've replaced
this.textModifier = m.seq('(', this.plainText, ')', this.modifier).ast;
with
this.textModifier = m.seq('(', m.choice(this.plainText, m.hyphen).oneOrMore, ')', this.modifier).ast;
This gets me a lot closer, for
(10-19-2016)[date:"mdy"]
from 10<emphasis level="reduced">19</emphasis>2016date:"mdy"
to <say-as interpret-as="date" format="mdy">2016</say-as>
I'll keep at it, although I am a bit puzzled right now and may require some more reading.
from speechmarkdown-js.
Nick, thanks for jumping in and helping on this! I really appreciate it.
from speechmarkdown-js.
I'm at the point where I have date passing, but now emphasis-short-reduced
is failing. I'm growing frustrated with the Myna library because it seems to have some illogical behavior where modifying unrelated variables in the SpeechGrammar get tests to pass/fail.
If the Grammar looks like this:
// Plain text
this.specialCharSet = '[]()*~`@#\\_!+';
this.specialCharSetHyphen = '[]()*~`@#\\_!+-';
this.ws = m.char(' \t').oneOrMore;
this.optWs = this.ws.opt;
this.wsOrNewLine = this.ws.or(m.newLine);
this.nonSpecialChar = m.notChar(this.specialCharSet).unless(m.newLine);
this.nonSpecialCharHyphen = m.notChar(this.specialCharSetHyphen).unless(m.newLine);
// this.specialChar = m.char(this.specialCharSet).ast;
this.quoteChar = m.notChar('"');
this.plainText = m.choice(m.digits, m.letters, this.ws, this.nonSpecialChar).oneOrMore.ast;
this.plainTextHyphen = m.choice(m.digits, m.letters, this.ws).oneOrMore.ast;
// ...
// Emphasis
this.shortEmphasisModerate = m.seq('+', this.plainText , '+').ast;
this.shortEmphasisStrong = m.seq('++', this.plainText , '++').ast;
this.shortEmphasisNone = m.seq('~', this.plainText , '~').ast;
this.shortEmphasisReduced = m.seq('-', this.plainTextHyphen , '-').ast;
this.emphasis = m.choice(this.shortEmphasisModerate, this.shortEmphasisStrong, this.shortEmphasisNone, this.shortEmphasisReduced);
the test fails.
If I just add a hyphen to this.specialCharSet
, which is not even being used in the reduced emphasis container:
// Plain text
this.specialCharSet = '[]()*~`@#\\_!+-';
this.specialCharSetHyphen = '[]()*~`@#\\_!+-';
this.ws = m.char(' \t').oneOrMore;
this.optWs = this.ws.opt;
this.wsOrNewLine = this.ws.or(m.newLine);
this.nonSpecialChar = m.notChar(this.specialCharSet).unless(m.newLine);
this.nonSpecialCharHyphen = m.notChar(this.specialCharSetHyphen).unless(m.newLine);
// this.specialChar = m.char(this.specialCharSet).ast;
this.quoteChar = m.notChar('"');
this.plainText = m.choice(m.digits, m.letters, this.ws, this.nonSpecialChar).oneOrMore.ast;
this.plainTextHyphen = m.choice(m.digits, m.letters, this.ws).oneOrMore.ast;
// ...
// Emphasis
this.shortEmphasisModerate = m.seq('+', this.plainText , '+').ast;
this.shortEmphasisStrong = m.seq('++', this.plainText , '++').ast;
this.shortEmphasisNone = m.seq('~', this.plainText , '~').ast;
this.shortEmphasisReduced = m.seq('-', this.plainTextHyphen , '-').ast;
this.emphasis = m.choice(this.shortEmphasisModerate, this.shortEmphasisStrong, this.shortEmphasisNone, this.shortEmphasisReduced);
the test passes.
I cannot figure out why.
from speechmarkdown-js.
@Fleker I added a discussion to the VoiceFirst Slack #speechmarkdown channel when you get a chance to look at it.
from speechmarkdown-js.
Related Issues (20)
- Grammar - ipa does not recognize characters
- Grammar - plainText does not recognize minus sign HOT 1
- Formatters - sections adding extra line breaks in SSML & Plain Text
- Special characters are ignored by the formatters in the output HOT 2
- Limitation to Node engine below 11 HOT 3
- Grammar - emphasis short format HOT 1
- Nested formatters break outside formatters HOT 7
- Support All US IPA Chars HOT 2
- Support umlauts and other languages HOT 3
- How to remove just Speechmarkdown markup but leave Markdown (i.e. NOT back to plain text)? HOT 5
- Fix "sub" tag so that it allows for words with spaces HOT 1
- Add dictionary to options for sub and phoneme HOT 1
- Support both double and single quotes HOT 1
- Add support of Microsoft Azure SSML HOT 1
- Ampersand leads to InvalidSsmlException
- Amazon Polly support HOT 3
- How to use speechmarkdown.min.js?
- How to use in python? HOT 1
- Dashes in dates get treated as emphasis HOT 1
- Modify output so code can run in a browser
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from speechmarkdown-js.