spencermountain / compromise

modest natural-language processing
http://compromise.cool
MIT License
11.43k stars 656 forks source link

If there is a Pre tag, the text from that term is not included in the HTML export #1073

Closed ryancasburn-KAI closed 8 months ago

ryancasburn-KAI commented 9 months ago

https://github.com/spencermountain/compromise/blob/4ef66b3e5798c63f3f0f3b7935ffae1597b6dd3b/src/1-one/output/api/html.js#L67

Test case:

  doc = nlp(`if i can recall, my grey dog loves pizza crusts (they are really good).`)
  html = doc.html({ '.red': 'my grey dog', '.blue': doc.match('loves') })
  t.equal(
    html,
    `if i can recall, <span class="red">my grey dog</span> <span class="blue">loves</span> pizza crusts (they are really good).`,
    here + 'html two classes'
  )

Currently returning:

if i can recall, <span class="red">my grey dog</span> <span class="redTwo">loves</span> pizza crusts ( are really good).

suggestion is:

out += t.pre || ''
out += t.text || ''

Any issues with that?

spencermountain commented 9 months ago

oh my gosh, it's missing the word?? yeah! please add a fix! holy cow

spencermountain commented 8 months ago

released as 14.11.1 - thank you!