Comments (3)
nice idea. will add to tokenize.js
you wanna do it?
from compromise.
note: I did it, I'll submit it with the fork but it raised two questions about
methods/tokenization/tokenize.js
This is what it looks now (with complete curly quotes replacement):
function normalise (str) {
if (!str) { return "" }
str = str.toLowerCase();
str = str.replace(/[,\.!:;\?\(\)]/, '');
// single curly quotes
str = str.replace(/[\u2018\u2019\u201A\u201B\u2032\u2035]+/g, "'");
// double curly quotes
str = str.replace(/[\u201C\u201D\u201E\u201F\u2033\u2036]+/g, '"');
if (!str.match(/[a-z0-9]/i)) { return '' }
return str
}
• Is the str
trimmed here already ?
and
• if the str
is not normalized in the end
if (!str.match(/[a-z0-9]/i)) {
we could normalize it further by your ../transliteration/unicode_normalisation.js
before
return ''
from compromise.
the fix looks great, i've added a test too.
from compromise.
Related Issues (20)
- [Improvement]: Bank of #Place - Rule. HOT 1
- [Improvement]: Government of #Country - Rule HOT 2
- [Improvement]: School Board - Rule HOT 4
- [Improvement]: Better compression algorithm HOT 3
- [Improvement]: Museum - Rule
- [Improvement]: Location Disambiguation \ Human Name Matching - Rule HOT 4
- [Improvement]: Corporation Rule HOT 7
- Unexpected behavior if "no space after period" HOT 3
- compromise-dates: types unavailable HOT 1
- Possible Issue with Root Matching HOT 1
- Uncaught TypeError: Cannot read properties of undefined (reading 'map') HOT 3
- Matched sentence text duplicated if match value occurs more than once in string HOT 2
- Property 'normalize' does not exist on type 'People'. HOT 4
- Feature Request: Proper Tagging of Names with Possessive Apostrophes HOT 6
- [Bug]: Syntax / Matching Parsing Issue. HOT 10
- Punctuation following abbreviations causes sentences to merge HOT 3
- `.not()` is destructive to punctuation HOT 4
- Feature Request: Add data to a term HOT 3
- Add TypeScript Support for Compromise-Dates HOT 2
- Website misspelling of "definitely" HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from compromise.