semvec/pypi-packages huggingface dataset:
jsonl-visualize 0.1.2
A TUI application to visually inspect and navigate JSON and JSONL data
License: MIT
Requires Python: >=3.7

# jsonl_visualize

jsonl_visualize is a versatile application that allows you to visually inspect and navigate JSON and JSONL (JSON Lines) data. It provides both a Terminal User Interface (TUI) and a Web-based User Interface for interactive exploration of JSON structures, handles parsing errors gracefully, and allows for easy exploration of large JSON datasets.

With JSONL error handling:
![jsonl_visualize tree view](img.png)

With modal view for large strings:
![jsonl_visualize modal screen](img_1.png)

## Installation

```
pip install jsonl_visualize
```

## Features

- Interactive tree view of JSON and JSONL data in both TUI and Web UI
- Supports both single JSON objects and JSONL (multiple JSON objects, one per line)
- Graceful handling of parsing errors, displaying them inline with successfully parsed data
- Expandable error nodes showing original unparsable text and error messages
- Truncation of long text values with the ability to view full text in a modal
- Keyboard navigation for easy exploration of the JSON structure in TUI mode
- Web-based interface for a more familiar and accessible visualization

## Usage

You can use jsonl_visualize in three ways:

1. With a JSON or JSONL file using the TUI:
   ```
   jsonl_visualize path/to/your/file.json
   ```

2. With piped input using the TUI:
   ```
   cat path/to/your/file.json | jsonl_visualize
   ```

3. With the Web UI option:
   ```
   jsonl_visualize --webui path/to/your/file.json
   ```
   or
   ```
   cat path/to/your/file.json | jsonl_visualize --webui
   ```

### TUI Keyboard Controls

- Arrow keys: Navigate the tree
- Enter: Expand/collapse nodes or view full text of truncated values
- 'q' or Ctrl+C: Quit the application
- 'b' or Escape: Go back from full text view to main tree view

### Web UI

The Web UI provides a familiar interface with collapsible tree nodes and expandable long text values. It opens in your default web browser, allowing for easy navigation and exploration of your JSON/JSONL data.

## Error Handling

When jsonl_visualize encounters a parsing error in a JSONL file, it will:

1. Display the error in red at the appropriate position in the tree.
2. Show the line number where the error occurred.
3. Allow you to expand the error node to see:
   - The original unparsable text
   - The specific error message

This allows you to inspect and debug issues in your JSON data easily.

## Installation (development)

1. Ensure you have Python 3.7 or higher installed on your system.

2. Clone this repository:
   ```
   git clone https://github.com/gr-b/jsonl_visualize.git
   cd jsonl_visualize
   ```

3. Install the required dependencies:
   ```
   pip install -e .
   ```

## Limitations

- The application loads the entire JSON/JSONL file into memory, so it may not be suitable for extremely large files.
- Syntax highlighting is not provided for the JSON structure in the TUI to maintain simplicity and performance.

## License

This project is licensed under the MIT License - see the LICENSE file for details.
torch-stoi 0.2.3
Computes Short Term Objective Intelligibility in PyTorch
License: MIT

## PyTorch implementation of STOI
[![Build Status][travis-badge]][travis]
[![PyPI Status](https://badge.fury.io/py/torch-stoi.svg)](https://badge.fury.io/py/torch-stoi)


Implementation of the classical and extended Short 
Term Objective Intelligibility in PyTorch.
See also [Cees Taal's website](http://www.ceestaal.nl/code/) and 
the [python implementation](https://github.com/mpariente/pystoi)

### Install
```bash
pip install torch_stoi
```

## Important warning
**This implementation is intended to be used as a loss function only.**  
It doesn't replicate the exact behavior of the original metrics
but the results should be close enough that it can be used 
as a loss function. See the Notes in the
 [`NegSTOILoss`](./torch_stoi/stoi.py) class.
 
Quantitative comparison coming soon hopefully :rocket:

### Usage
```python
import torch
from torch import nn
from torch_stoi import NegSTOILoss

sample_rate = 16000
loss_func = NegSTOILoss(sample_rate=sample_rate)
# Your nnet and optimizer definition here
nnet = nn.Module()

noisy_speech = torch.randn(2, 16000)
clean_speech = torch.randn(2, 16000)
# Estimate clean speech
est_speech = nnet(noisy_speech)
# Compute loss and backward (then step etc...)
loss_batch = loss_func(est_speech, clean_speech)
loss_batch.mean().backward()
```

### Comparing NumPy and PyTorch versions : the static test
Values obtained with the NumPy version (commit [84b1bd8](https://github.com/mpariente/pystoi/commit/84b1bd8f894c76eb5ddc3425946a4e2052e825fe)) are compared to
the PyTorch version in the following graphs.  
##### 8kHz
Classic STOI measure

<img src="./plots/8kHzwithVAD.png" width="400"/> <img src="./plots/8kHzwoVAD.png" width="400"/>

Extended STOI measure

<img src="./plots/8kHzExtendedwithVAD.png" width="400"/> <img src="./plots/8kHzExtendedwoVAD.png" width="400">

##### 16kHz
Classic STOI measure

<img src="./plots/16kHzwithVAD.png" width="400"> <img src="./plots/16kHzwoVAD.png" width="400">

Extended STOI measure

<img src="./plots/16kHzExtendedwithVAD.png" width="400"> <img src="./plots/16kHzExtendedwoVAD.png" width="400">


16kHz signals used to compare both versions contained a lot
of silence, which explains why the match is very bad without 
VAD. 

### Comparing NumPy and PyTorch versions : Training a DNN
Coming in the near future

### References
* [1] C.H.Taal, R.C.Hendriks, R.Heusdens, J.Jensen 'A Short-Time
  Objective Intelligibility Measure for Time-Frequency Weighted Noisy Speech',
  ICASSP 2010, Texas, Dallas.
* [2] C.H.Taal, R.C.Hendriks, R.Heusdens, J.Jensen 'An Algorithm for
  Intelligibility Prediction of Time-Frequency Weighted Noisy Speech',
  IEEE Transactions on Audio, Speech, and Language Processing, 2011.
* [3] J. Jensen and C. H. Taal, 'An Algorithm for Predicting the
  Intelligibility of Speech Masked by Modulated Noise Maskers',
  IEEE Transactions on Audio, Speech and Language Processing, 2016.


[travis]: https://travis-ci.com/mpariente/pytorch_stoi
[travis-badge]: https://travis-ci.com/mpariente/pytorch_stoi.svg?branch=master