Comments (4)
We should handle empty strings as it seems like something that could easily happen in an automated system. Either by a) removing them, or b) first excluding them and then adding them back to the result as np.nan for all metrics, or c) raising an error.
a) is the easiest but if the end user expect the same number of rows as they inputted, it's problematic.
b) is probably the best as you would maintain the number of rows in the output with the order matching the input. But this increases complexity of the code as you first have to exclude the empty strings, remember their index and then insert them in the output. Technically you just have to store the indices I guess, although insertion of multiple empty rows might be tricky?
c) would require the user to decide between a) and b) (and then implement it). Seems annoying.
I would probably go with b
Further, perhaps we should have a look at whether to add a check for the length of span in the calculation or just allow it to fail with zero-division?
from textdescriptives.
Completely agree that b is the way to go. We actually already have handling for this in all components except quality
and information_theory
. If a metric can't be calculated (e.g. because of empty string) we return np.nan
.
@KennethEnevoldsen you know the code for those components the best - is this something you'd be able to take a look at?
from textdescriptives.
And add a unit test when you're at it @KennethEnevoldsen ;)
from textdescriptives.
🫡
from textdescriptives.
Related Issues (20)
- Make output of doc._.quality specify if each filter was passed HOT 3
- New Metric: hertz component HOT 2
- New Metric: Approximate entropy HOT 2
- Add proportion of word in vocabuary
- Add Unigram entropy
- How is `doc_length` different from other length measures such as `n_characters`? HOT 3
- Ensure component consistency HOT 4
- Quick start not working as expected HOT 4
- Quickstart broke on Spacy example HOT 1
- Issue with tests HOT 1
- Failing test HOT 5
- Demos / Browser-Based Usage HOT 34
- Support transformer models
- Pyphen does not support all languages that spaCy does HOT 2
- Listed metrics deviate between extraction functions in docs HOT 7
- References for readability metrics HOT 4
- Croatian language requires `lexeme_prob` table HOT 6
- Different readability scores between textdescriptives and textstat HOT 3
- Readability documentation is wrongly formatted
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 textdescriptives.