h-dong / serina Goto Github PK
View Code? Open in Web Editor NEWNatural Language Parser for date and time in Javascript
Home Page: https://serina.netlify.com
License: MIT License
Natural Language Parser for date and time in Javascript
Home Page: https://serina.netlify.com
License: MIT License
We should revisit the source code and see what was used to ensure ES5 compatibility. Or maybe ES6 compatibility is enough?
for...of
or for...in
I've selected for refactoring 7 lines of code which are duplicated in 2 file(s) (1, 2). Addressing this will make our codebase more maintainable and improve Better Code Hub's Write Code Once guideline rating! ๐
Here's the gist of this guideline:
You can find more info about this guideline in Building Maintainable Software. ๐
โน๏ธ To know how many other refactoring candidates need addressing to get a guideline compliant, select some by clicking on the ๐ฒ next to them. The risk profile below the candidates signals (โ ) when it's enough! ๐
Good luck and happy coding! โจ ๐ฏ
Right now there is no indicator of what was parsed, it would be useful to return with each match something like this:
foundTime: true,
foundDate: false
E.g have a library that can turn string into numerical value that easily consumed
e.g. "8:30am" => { hour: 8, minute: 30 }
What the title said.
Using global
in Regex checks seems to have to some weird behaviours. See https://stackoverflow.com/a/2630538. Should review all g
usages, if it is safe to remove then we should remove them.
One thing to consider is how well does these Regex check work with long text, maybe the ones that includes tab
, new line
and etc. Maybe need to check for m
(multi-line) instead of g
?
Since we have added optional filler word to date-time match, we should do the same for date matches too just to be consistent.
It is weird to allow "a" and "1" but not "one". We should be able to parse all of them.
Reproduce:
Match sun tomorrow
returns match tomorrow
Match su tomorrow
returns Match su
E.g. convertDateStringToObj.ts
and convertTimeStringObj.ts
See slide no 25 & 26 -> https://growth.design/case-studies/superhuman-user-onboarding/
I think the Superhuman event parser is the best thing out there so a copy of that would be awesome.
Are you still planning to complete the milestones or working on other projects?
I think this is the best NLP event parser library out there in JavaScript other than Sherlock :)
If going for ES5 output, then either polyfill or use alternative loops.
Use the provided test.each()
method to test long list of test cases.
Documentation Link: https://jestjs.io/docs/en/api#testeachtable-name-fn-timeout
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.