Giter VIP home page Giter VIP logo

Comments (4)

Fleker avatar Fleker commented on July 17, 2024

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.

rmtuckerphx avatar rmtuckerphx commented on July 17, 2024

Nick, thanks for jumping in and helping on this! I really appreciate it.

from speechmarkdown-js.

Fleker avatar Fleker commented on July 17, 2024

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.

rmtuckerphx avatar rmtuckerphx commented on July 17, 2024

@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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.