Git Product home page Git Product logo

decancer's Issues

`decancer` automatically lowercases all characters

Hi there,

I'm experiencing an issue where decancer automatically lowercases all uppercase letters. As far as I understand, this is unintentional behavior (since it is not documented anywhere I looked). If it is intentional, could we have an option that keeps the case of non-violating characters?

Issue Details

  • decancer Version: 2.0.2
  • macOS Version: 14.3.1
  • Chip: Apple M2 Pro
  • Architecture: arm64
  • Node.js Version: v20.4.0
  • Behavior: The package automatically converts all uppercase letters to lowercase.
  • Expected Behavior: The case of non-violating characters should be preserved.

Minimal Reproduction

import decancer from "decancer"

console.log(decancer("Test").toString()) // Expected output: "Test", actual output: "test"
console.log(decancer("TeSt").toString()) // Expected output: "TeSt", actual output: "test"

Undefined behavior in tests

range: MaybeUninit::uninit().assume_init(),
This is always undefined behavior, as although not read it is still a value that is being created and passed to llvm as noundef. This will cause aborts in a couple Rust versions, when this pattern is compiled to ud2 (undefined instruction, abort instantly).

This is already being caught by running clippy locally, which I suggest is added to CI, under the clippy::uninit_assumed_init lint.

Python bindings?

Is your feature request related to a problem?

There currently aren't any good libraries for decancering text in python.

Describe the solution you'd like

I'd like python bindings using a lib such as PyO3.

Describe alternatives you've considered

I tried reinventing the wheel but failed and would love to integrate this perfectly working library into my python projects as well.

Support for Arabic

Hi,
I expect text of different languages, arabic included.
Take this sentence from https://ar.lipsum.com/

import decancer from 'decancer'

const str = decancer('لا أحد يحب الألم بذاته، يسعى ورائه أو يبتغيه').toString()
console.log(str)

This gives a very scrambled text:

oseتبs gi osijg seسs ,oتiذب مjiji بcs دci ij

Thank you for providing Decancer :)

Implement unicode bidi support

Ever since July 2023, i have been thinking about adding back Arabic and Hebrew support for decancer without causing issues because of their right-to-left madness. Then i've found unicode-bidi which rerenders your mixed RTL/LTR text in memory as it were to be rendered by a web browser.

The plan is to somehow implement its algorithm here - an attempt has been in the works since then, but due to school and the complexity of Unicode's bidirectional algorithm, it has been in hiatus for months.

Because of this, development on this library has (publicly) stagnated as the attention has been directed to this enhancement.

Wrong type definition ?

Hi @null8626 ,
Thank you for providing this very fast and bright library !

On VSCode, I'm putting some coding rules with TS and Eslint (only on IDE, it's still a JS project), I'm having an error on decancer function

This expression is not callable.
Type 'typeof import("c:/Users/Administrator/WebstormProjects/classified-ads/node_modules/decancer/src/typings")' has no call signatures.

[JAVA] java.lang.ExceptionInInitializerError when running JUnit tests using new CureString("string")

Description

When running JUnit tests that use this library - calling new CuredString("value") results in an exception

Caused by: java.lang.RuntimeException: [x86_64-unknown-linux-gnu] this operating system (Linux) and/or architecture (x64) is not supported.
original error:
no decancer-x86_64-unknown-linux-gnu in java.library.path: /usr/java/packages/lib:/usr/lib64:/lib64:/lib:/usr/lib
	at com.github.null8626.decancer.CuredString.<clinit>(CuredString.java:70)
	... 48 more

I have identified the issue is with the exception for loading the library for JUnit tests.

if (CuredString.isJUnit()) {
    System.loadLibrary("decancer-" + rustTarget);
}

I assume it was supposed to detect test runs for regression testing of this library. But it does not distinguish it from running it from another project. It goes through the thread stack trace and checks the class name, looking for the first appearence of org.junit element.getClassName().startsWith("org.junit.")

If I remove the condition for JUnit tests and use the NativeUtils to load the library as is used for the production use. It works well in the unit tests as well.

Would it be possible to create a more sophisticated approach to detecting which unit tests are run?

Steps to Reproduce:

  1. Create a new project
  2. import the library
<dependencyManagement>
    <dependencies>
        <dependency>
            <groupId>com.github.null8626</groupId>
            <artifactId>decancer</artifactId>
            <version>v3.2.0</version>
        </dependency>
    </dependencies>
</dependencyManagement>          
<repositories>
    <repository>
        <id>jitpack.io</id>
        <url>https://jitpack.io</url>
    </repository>
</repositories>
  1. Create and run JUnit tests using this library

Environment:

OS: Ubuntu 24
Java Version: Java 21
Library Version: v3.2.0

feature request: equal/startsWith/endsWith

I allow users to create simple patterns with asterisks which boils down to equal/startsWith/endsWith/contains. This is currently the only missing feature from adopting this library in production.

  • test -> equal
  • test* -> startsWith
  • *test -> endsWith
  • *test* -> contains

I'd really love to see these functions being added <3. Thanks!

`cure` hangs when fed specific character

I.e. when fed unicode character “ˑ” (U+02D1) (Modifier Letter Half Triangular Colon):

fn main() {
    println!("{}", decancer::cure("ˑ").as_str());
    println!("This never prints.");
}

Add safety comments for unsafe portions of code.

See #14 for full comments.

Some portions utilize unsafe code to optimize performance. It would be useful for developers (current and future) if the purpose and invariants of the unsafe code were laid out in a comment to prevent violations.

[java] Migrate from Jitpack

As of version v3.2.0, i've noticed that Jitpack no longer allows newer releases of the Java binding of decancer due to the repository's history exceeding 500 MB.

Therefore, i am currently in the process of migrating from jitpack to another host! Sadly, this may delay future releases.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.