question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Commas in whitespcae

See original GitHub issue
const result = compromise.nlp(`We just released, "Square Up".`);

const textArray = result.map(obj => obj.text);
console.log(textArray);
// ['We', 'just', 'released,', 'Square', 'Up"']

I think it should be one of either case: 1) the 4th element should be'"Square', or 2) the fifth element should be Up. As far as I know, this library’s text property is designed to include,, ", ‘`’ (https://github.com/spencermountain/compromise/blob/master/src/text/methods/normalize.js#L22). So, I believe it should have been the former case.

(Btw, is it correct that spaceBefore and spaceAfter contains quotation symbols? I’m asking this because the property is named as spaceXXX.)

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:7 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
ohtangzacommented, Dec 6, 2019

@spencermountain Checked your message! Looks good now!

cc: @ghsdh3409

1reaction
spencermountaincommented, Dec 2, 2019

hey Jeungmin, this has been refactored in v12, and seems to make a little more sense:

const doc = nlp(`We just released, "Square Up".`)
console.log(doc.json({ terms: { whitespace: true } })[0])

/*{ text: 'We just released, "Square Up".',
  terms:
   [ { text: 'We', tags: [Array], pre: '', post: ' ' },
     { text: 'just', tags: [Array], pre: '', post: ' ' },
     { text: 'released', tags: [Array], pre: '', post: ', ' },
     { text: 'Square', tags: [Array], pre: '"', post: ' ' },
     { text: 'Up', tags: [Array], pre: '', post: '".' } ] }
*/

thanks for your patience.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Replace spaces with commas Online - Convert Town
This tool replaces all the spaces with commas in your text. Tools Newsletter.
Read more >
How to split a string by white space or comma? - Stack Overflow
This particular regex splits on a sequence of one or more commas or spaces, so that e.g. multiple ... [\s,] matches one white...
Read more >
Python | Split String by Comma and Whitespace - Finxter
Summary: To split a string by comma and whitespace, you can use a list comprehension that splits the given string by comma and...
Read more >
Commas are whitespace in Clojure. You can use them if you ...
Commas are whitespace in Clojure. You can use them if you want to, it's just not idiomatic. jb1991 on Oct 22, 2017 [–]....
Read more >
value-list-comma-space-after - Stylelint
Require a single space or disallow whitespace after the commas of value lists. ... The fix option can automatically fix most of the...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found