HumanSignal / HumanSignal/label-studio
Check empty strings for txt files
- Dominant language
- TypeScript
- Stars
- 28.3k
- Forks
- 3.7k
- Avg merge
- 14h
- Merged PRs (30d)
- 15
Description
**Is your feature request related to a problem? Please describe.**
When uploading a txt file, it doesn't seem right how it considers the text as tasks. The option to treat different paragraphs as different tasks with !Treat as List of Tasks" feature is great. However, it creates a new task everytime it sees a linebreak. For many txt files this means an empty content task for every paragraph change, since there are two line breaks in-between paragraphs.
**Describe the solution you'd like**
To solve this, I would like to add a check before creating the task for txt files.
I ran through your code and I believe the change would be on
label_studio/data_import/models.py at line 88 the list comprehension could go from:
tasks = [{'data': {settings.DATA_UNDEFINED_NAME: line}} for line in lines]
to
tasks = [{'data': {settings.DATA_UNDEFINED_NAME: line}} for line in lines if line!='']
This will make it so it doesn't create empty tasks
I don't think no one would want to have empty tasks on their projects, so this seems like it will not create any problem, hope you can add it.
Contributor guide
Assessment
This issue has not been assessed yet.