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.

How custom match with no spaced number and string

See original GitHub issue

Love the tool 💯 i’m having this issue to match string containing number and custom unit with or without space.

i used plugin to add new word to #Unit tag

nlp.plugin({
  words: {
     sotok: 'Unit'
  }
});

eg: #Cardinal #Unit does match with 24 sotok but doesn’t match with 24sotok

nlp(`24 sotok`).match("#Cardinal #Unit").out("array") //  ✅ 

nlp(`24sotok`).match("#Cardinal #Unit").out("array") //  ❌

I can use regex to do that but is there any way to do with existing tags in compromise?

There must be something i’m doing wrong as i have seen the exising money tag does the same.

const money = nlp("$33.2cad").money().json()

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
spencermountaincommented, Jul 2, 2022

hey @nilooy this is fixed now in 14.4.0. I wanted to do something that normalized ‘2l’ ‘2 litre’ and ‘2 litres’ but it got too messy.

for now, ‘2foo’ will tokenize as [‘Value’, ‘Unit’], no matter what, and ambiguous units like ‘m’ will tag asa unit, when following a number cheers

1reaction
spencermountaincommented, Jul 1, 2022

hey, #Value #Units will work for both cases, (both ‘24 sotok’ and ‘24sotok’) in next week’s release. i’ll let you know when it’s published cheers

Read more comments on GitHub >

github_iconTop Results From Across the Web

Regex for field that allows numbers and spaces - Stack Overflow
This regular expression matches numbers with spaces, numbers without spaces, but not the spaces after all numbers (\s*[0-9]+)+.
Read more >
Custom numeric format strings - Microsoft Learn
Learn how to create a custom numeric format string to format numeric data in .NET. A custom numeric format string has one or...
Read more >
Excel MATCH function with formula examples - Ablebits
See how to match data in Excel using the MATCH function. Basic uses and advanced formula examples for case-sensitive match, Vlookup and ...
Read more >
Writing YARA rules — yara 4.2.0 documentation
... can appear contiguously or separated by spaces. Decimal numbers are not allowed in hex strings. ... Any of the following strings will...
Read more >
15: 9.4. String Functions and Operators - PostgreSQL
Returns number of bytes in the string. Since this version of the function accepts type character directly, it will not strip trailing spaces....
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