semvec/pypi-packages huggingface dataset:
tokdoca 0.2.0
A package for calculating token costs and processing text from various file types.
Requires Python: >=3.6

# tokdoca

`tokdoca` is a Python package that helps you calculate the number of tokens and processing costs based on various OpenAI models. This package also supports PDF, JSON, and TXT files, and you can either input text directly or extract it from these files.

## Installation

To install the `tokdoca` package, simply run the following command in your terminal:

```bash
pip install tokdoca


from tokdoca import process_input

file_path = "path/to/your/file.pdf"  # or a JSON or TXT file
token_count, input_cost, output_cost, total_cost = process_input(file_path)

print(f"Total tokens: {token_count}")
print(f"Input cost: {input_cost} USD")
print(f"Output cost: {output_cost} USD")
print(f"Total cost: {total_cost} USD")


text_input = "This is a sample text for processing."
token_count, input_cost, output_cost, total_cost = process_input(text_input)

print(f"Total tokens: {token_count}")
print(f"Input cost: {input_cost} USD")
print(f"Output cost: {output_cost} USD")
print(f"Total cost: {total_cost} USD")
ultimatesmoother 1.0.0
The UltimateSmoother preserves low-frequency swings in the input time series while attenuating high-frequency variations and noise.
Requires Python: >=3.8
Keywords: band-pass, band-stop, filtering, high-pass, low-pass, smoothing, time series

# The Ultimate Smoother

This is a python implementation of the digital smoothing filter introduced by John Ehlers in his article ["The Ultimate Smoother"](https://www.mesasoftware.com/papers/UltimateSmoother.pdf).

## Concepts

The UltimateSmoother preserves low-frequency swings in the input time series while attenuating high-frequency variations and noise. The defining input parameter of the UltimateSmoother is the critical period, which represents the minimum wavelength (highest frequency) in the filter's pass band. In other words, the filter attenuates or removes the amplitudes of oscillations at shorter periods than the critical period.

According to Ehlers, one primary advantage of the UltimateSmoother is that it maintains **zero lag** in its pass band and minimal lag in its transition band, distinguishing it from other conventional digital filters (e.g., moving averages). One can apply this smoother to various input data series.

## Calculations

On a technical level, the UltimateSmoother's unique response involves subtracting a high-pass response from an all-pass response. At very low frequencies (lengthy periods), where the high-pass filter response has virtually no amplitude, the subtraction yields a frequency and phase response practically equivalent to the input data
At other frequencies, the subtraction achieves filtration through cancellation due to the close similarities in response between the high-pass filter and the input data.

## Usage

```python
from ultimatesmoother import ultimate_smoother

us = ultimate_smoother(data, period)
```
tokendollar 0.1.1
محاسبه تعداد توکن و هزینه پردازش متن برای مدل‌های OpenAI
Requires Python: >=3.7

from tokendollar import count_tokens, calculate_cost

text = "این یک متن آزمایشی است."
tokens = count_tokens(text, "gpt-4o")
cost = calculate_cost(tokens, "gpt-4o")

print(f"🔹 تعداد توکن‌ها: {tokens}")
print(f"💰 هزینه‌ی کل: {cost[2]} دلار")




text = "testfile.pdf" #json and txt are supported
tokens = count_tokens(text, "gpt-4o")
cost = calculate_cost(tokens, "gpt-4o")


print(f"🔹 تعداد توکن‌ها: {tokens}")
print(f"💰 هزینه‌ی کل: {cost[2]} دلار")