Code Monkey home page Code Monkey logo

tanmaypatil123 / regexai Goto Github PK

View Code? Open in Web Editor NEW

This project forked from riteshtambe/regexai

0.0 0.0 0.0 37 KB

RegexAI is a user-friendly library powered by generative AI, simplifying regular expression use. It interprets plain language regex queries, making data extraction and text manipulation easy. Whether you're a beginner or pro, RegexAI adapts to your needs, streamlining regex tasks for enhanced efficiency and accessibility.

License: MIT License

Python 100.00%

regexai's Introduction

RegexAi

Release License: MIT Open in Colab

RegexAI is a user-friendly library powered by generative AI, simplifying regular expression use. It interprets plain language regex queries, making data extraction and text manipulation easy. Whether you're a beginner or pro, RegexAI adapts to your needs, streamlining regex tasks for enhanced efficiency and accessibility.

🔧 Quick install

pip install regexai

🔍 Demo

Try out RegexAI in your browser :

Open in Colab

RegexAI is designed to be used in conjunction with regex. It makes regex conversational, allowing you to ask questions to your data in natural language.

Queries

For example, you can ask RegexAI to Find words that contain the letter 'q' but not followed by 'u,' and replace them with the word 'quarantined.' from the user given paragraph :

from regexai.pattern import apikey

# Sample paragraph and regex query
test_paragraph = """In a racecar, the radar detected an abnormal level of radioactive materials. Please contact support at [email protected] or visit our website at https://www.example.com. You can also reach us at +1 (123) 456-7890. For inquiries, please send an email to [email protected]. Remember, regex is a powerful tool that can validate 1234 different types of input data! Not all q
words are quirky, but regex can help you find them. Please enter your 16-digit credit card number: 4532015115898164.""" 
query = """ Find words that contain the letter 'q' but not followed by 'u,' and replace them with the word 'quarantined.' """

# Instantiate an object
od=apikey("your openai key")
print("Output : ", od.find_all(test_paragraph,query))
print("Generated Code for your Query : ")
print(od.get_pattern())

The above code will return the following:

Output :  In a racecar, the radar detected an abnormal level of radioactive materials.
Please contact support at [email protected] or visit our website at https://www.example.com. You can also reach us at +1 (123) 456-7890. For inquiries, please send an email to [email protected]. Remember, regex is a powerful tool that can validate 1234 different types of input data! Not all quarantined words are quirky, but regex can help you find them.
Please enter your 16-digit credit card number: 4532015115898164.

Generated Code for your Query : 
import re
result = re.sub(r'\bq(?!u)\w+\b', 'quarantined', da)

Of course, you can also ask RegexAI to perform more complex queries depending upon your need and requirements.

🔒 Privacy & Security

In order to protect your privacy and safety , we do not save any type of file or data on our side and the package totally runs on your local system.

🤝 Contributing

Contributions are welcome! Please check out the to-dos below, and feel free to open a pull request.

To-dos:

  1. Connect with different file sources feteching from different databases.
  2. Ideas to bypass token limit set by openai.
  3. Multiagent capabilities to perform parallel operations on different chunk of text data.
  4. Any contributions which you think can boost regexai use in your daily life.

For more information, please visit our github page.

After installing the virtual environment, please remember to install pre-commit to be compliant with our standards:

pre-commit install

Contributors

Contributors

📜 License

RegexAI is licensed under the MIT License. See the LICENSE file for more details.

Acknowledgements

  • This project is based on the regex library by independent contributors, but it's in no way affiliated with the regex project.
  • This project is meant to be used as a tool for data extraction, feature processing from textual data, and it's not meant to be used for production purposes. Please use it responsibly.

regexai's People

Contributors

riteshtambe avatar rajadhikar7 avatar shreyash321 avatar

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.